code file Linear Regression Practical Session - Part - 2

SAS Analytics Linear Regression-Case Study & Practical session
11 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€65.59
List Price:  €93.70
You save:  €28.11
£56.11
List Price:  £80.17
You save:  £24.05
CA$96.29
List Price:  CA$137.56
You save:  CA$41.27
A$108.61
List Price:  A$155.17
You save:  A$46.55
S$95.18
List Price:  S$135.98
You save:  S$40.79
HK$548.09
List Price:  HK$783.01
You save:  HK$234.92
CHF 63.62
List Price:  CHF 90.89
You save:  CHF 27.27
NOK kr770.78
List Price:  NOK kr1,101.16
You save:  NOK kr330.38
DKK kr489.42
List Price:  DKK kr699.21
You save:  DKK kr209.78
NZ$118.08
List Price:  NZ$168.70
You save:  NZ$50.61
د.إ257.04
List Price:  د.إ367.21
You save:  د.إ110.17
৳7,659.43
List Price:  ৳10,942.52
You save:  ৳3,283.08
₹5,847.07
List Price:  ₹8,353.31
You save:  ₹2,506.24
RM334.79
List Price:  RM478.30
You save:  RM143.50
₦90,777.03
List Price:  ₦129,687.03
You save:  ₦38,910
₨19,427.14
List Price:  ₨27,754.24
You save:  ₨8,327.10
฿2,573.47
List Price:  ฿3,676.55
You save:  ฿1,103.07
₺2,275.24
List Price:  ₺3,250.48
You save:  ₺975.24
B$366.28
List Price:  B$523.28
You save:  B$157
R1,332.50
List Price:  R1,903.66
You save:  R571.15
Лв128.20
List Price:  Лв183.15
You save:  Лв54.95
₩96,220.81
List Price:  ₩137,464.20
You save:  ₩41,243.38
₪265.25
List Price:  ₪378.95
You save:  ₪113.69
₱4,004.45
List Price:  ₱5,720.89
You save:  ₱1,716.43
¥10,808.04
List Price:  ¥15,440.72
You save:  ¥4,632.68
MX$1,187.23
List Price:  MX$1,696.11
You save:  MX$508.88
QR254.64
List Price:  QR363.78
You save:  QR109.14
P964.57
List Price:  P1,378.02
You save:  P413.44
KSh9,308.67
List Price:  KSh13,298.67
You save:  KSh3,990
E£3,394.91
List Price:  E£4,850.08
You save:  E£1,455.17
ብር3,970.94
List Price:  ብር5,673.01
You save:  ብር1,702.07
Kz58,616.62
List Price:  Kz83,741.62
You save:  Kz25,125
CLP$68,515.31
List Price:  CLP$97,883.21
You save:  CLP$29,367.90
CN¥506.66
List Price:  CN¥723.83
You save:  CN¥217.17
RD$4,125.31
List Price:  RD$5,893.56
You save:  RD$1,768.24
DA9,412.64
List Price:  DA13,447.21
You save:  DA4,034.56
FJ$158.92
List Price:  FJ$227.04
You save:  FJ$68.12
Q542.78
List Price:  Q775.43
You save:  Q232.65
GY$14,611.69
List Price:  GY$20,874.74
You save:  GY$6,263.05
ISK kr9,858.79
List Price:  ISK kr14,084.59
You save:  ISK kr4,225.80
DH708.36
List Price:  DH1,011.98
You save:  DH303.62
L1,252.84
List Price:  L1,789.85
You save:  L537.01
ден4,036.97
List Price:  ден5,767.34
You save:  ден1,730.37
MOP$562.89
List Price:  MOP$804.17
You save:  MOP$241.27
N$1,328.43
List Price:  N$1,897.84
You save:  N$569.40
C$2,568.70
List Price:  C$3,669.73
You save:  C$1,101.03
रु9,342.21
List Price:  रु13,346.58
You save:  रु4,004.37
S/262.58
List Price:  S/375.13
You save:  S/112.55
K265.26
List Price:  K378.96
You save:  K113.70
SAR262.55
List Price:  SAR375.09
You save:  SAR112.53
ZK1,763.89
List Price:  ZK2,519.95
You save:  ZK756.06
L326.30
List Price:  L466.17
You save:  L139.86
Kč1,658.23
List Price:  Kč2,369.01
You save:  Kč710.77
Ft25,839.41
List Price:  Ft36,915.02
You save:  Ft11,075.61
SEK kr762.42
List Price:  SEK kr1,089.22
You save:  SEK kr326.80
ARS$60,837.09
List Price:  ARS$86,913.85
You save:  ARS$26,076.76
Bs483.29
List Price:  Bs690.45
You save:  Bs207.15
COP$273,779.82
List Price:  COP$391,130.80
You save:  COP$117,350.97
₡34,969.07
List Price:  ₡49,957.95
You save:  ₡14,988.88
L1,722.93
List Price:  L2,461.44
You save:  L738.50
₲516,485.32
List Price:  ₲737,867.79
You save:  ₲221,382.47
$U2,722.73
List Price:  $U3,889.78
You save:  $U1,167.05
zł284.09
List Price:  zł405.87
You save:  zł121.77
Already have an account? Log In

Transcript

We had started with the practical session of linear regression where we were using a customer satisfaction data sets whose name was linear underscore reg underscore retail, the data set consists of 14 variables, where the first variable is the dependent variable that is customer satisfaction, all the variables are independent variables. So, we are going to predict the value of customer satisfaction that is a dependent variable using the 13 independent variables. So, in our last video, we have done regression procedure and we have checked for multicollinearity for the independent variables using the keyword VI, which stands for variance inflation factor, and we had found out that delivery speed was the independent variable with the maximum value of Vi F, showing maximum multicollinearity. So, So, we have removed the variable delivery speed from the set of independent variables and again, we had executed the regression procedure and used the keyword vi to check for multicollinearity for the rest of the independent variables from product quality to price flexibility, and we found out that the VA values were quite low showing that there is less multicollinearity which is the actual assumption for classical linear regression model that is multicollinearity for the data should be low.

So our objective of minimum multicollinearity of our data is fulfilled. Now in this video, we will be checking for autocorrelation and heteroscedasticity. So for that, we will be doing the code proc reg. Data equals my lip one dot mileage one is a library named linear underscore, reg. underscore read. This is the name of my data set model is the key word to build the classical linear regression model where my dependent variable is customer satisfaction.

Then I'm specifying the range of the independent variables starting from product quality. Till price flexibility, we have to specify the names of the independent variables or names of any of the variable. The weight is given in the data set otherwise SAS will not identify them. So we have to write exactly the way it is given the data set the variables, the variable names. product quality is my first variable that is first independent variable price price flexibility is my last independent variable because we have removed from Dell very sweet. We are using the keyword bw to check for autocorrelation VW stands for Durbin Watson test and you will know Durbin Watson test which is used to check for correlation there the H naught the H naught of the null hypothesis for the Durbin Watson test is there is no correlation for the data an alternative hypothesis that is each one is there is an autocorrelation for the data so, let's run this code whichever autocorrelation we are doing the dorsum test.

So, this is manda Watson test results. The leader blue statistic values disappeared that is 2.377 as you move that If our dw statistic value lies between 1.5 to 2.5, then it is said that there is no autocorrelation here the p value for the Durbin Watson test is not displayed. So, from the DW statistic only, we have to draw the interpretation which is showing that there is no correlation since the DW statistic value that is 2.377 is falling between the range 1.5 to 2.5. This is my parameter estimates table, my Aspen adjusted R square values are the same, that is 80% username percent, this is my analysis of variance table and the number of observations in many cases it is 200. So, these mean number of observations are only used to run the regression procedures. Now, since in my dw tester devinwatson test, we did not get the p value.

Therefore, we will be doing another test to check for autocorrelation and heteroscedasticity. And that test is called spec Test specification test. So let's do the spec test to specification test we are going to use the same procedure that is proc freq. Data equals my library name is my lip, one dot dataset name is linear. underscore, reg. underscore retail mall there is a keyword perform the classical linear regression model.

Customer satisfaction is a dependent variable. The range of independent variable starts from product quality, price, flexibility We have to write the variables. Name, the weight is given in the data set. I'm not specifying the individual variable names. Instead of that, we are just specifying the range of independent variables. My key word to do the test for autocorrelation and heteroscedasticity spec stands for specification test.

Okay. Cross specification test, my null hypothesis is there is no heteroscedasticity and autocorrelation for the data and the alternative hypothesis is there is an heteroscedasticity and autocorrelation for the data. So, let's run this code and do the specification test. So, this is my specification test results. See, the p value is displayed that is 0.1030 as you know The default level of significance in SAS is 0.05 that is 5% level of significance and if our P value is greater than the level of significance, then we accept the null hypothesis. So, here will be 00 point 1030 which is greater than 0.05.

So, I will be accepting the value purchases, that is my data does not have any heteroscedasticity and autocorrelation that is an analysis perspective that that is there is no heteroscedasticity and autocorrelation This is an environmental estimates table that is these are the independent variables that are used to the regression procedure. I got the R square adjusted R squared value that is it's the same 80% is entering point one 6%. We also got the analysis of variance table and we also got the number of observations that are used to run the regression procedure that is 200 observations. Okay, in this video we'll be doing till here. So before I move to the next video, let me recap The concepts that we had done for the last videos, we had worked with a customer satisfaction data set whose name was linear underscore reg underscore retail, he first brought the data set in, in the SAS environment using the live name statement, then we have checked for multicollinearity using the regression procedure for all independent variables, and whichever model multicollinearity we had used the keyword called vi F, which stands for variance inflation factor, we had found out that Derby speed was the independent variable with maximum value of wave.

So we had removed that V speed from the set of independent variables. And we had included all the independent variables from product quality reprise flexibility in our classical linear regression model, and again we are check for multicollinearity using the keyword var For the regression procedure, and we found out that the VA values were quite low. So, our objective to get minimum multicollinearity for our data got fulfilled, because that is assumption of classical linear regression model, that is independent variables should have minimum of multicollinearity. Then we had checked for autocorrelation for our data using dw test, dw tests transferred all the Watson tests were may not hypothesis there is no correlation. And my alternative hypothesis is there is an autocorrelation in in our dw test results, we got the value of dw statistic, which was around 2.377. And as we know that if our dw statistic value lies between 1.5 to 2.5, then there is no accumulation for our data.

So, since our dw statistic value lies in the range of 1.5 to 2.5. Therefore, there was no other coalition. That is there is not a correlation for data. Next, just because we did not get the p value for our revenue or some test, we Another test to check for adverse plasticity and autocorrelation and that that is called SPECT test, which stands for specification when my null hypothesis there is no it was the density and autocorrelation in order alternative hypothesis there is an heteroscedasticity in autocorrelation. So, we got a p value which is greater than our level of significance that is 0.05 level of significance by default is 0.05. And the p value that we are obtained was greater than 0.05 was around 0.1030.

So, we had accepted the null hypothesis for our specification test and we had got that there is no need to stress it in autocorrelation. For our data. In our upcoming videos, we will be dividing the data into two parts that history and validation we will be building our model based on our training data and we will be applying the results on validation we will be doing stepwise selection, we will also predict the value of our dependent variable for both the training and validation data and we will be finding the correlation between the observed value of our dependent variable And predicted value of our dependent variable for both the training data and validation data. So for now, let's end the video over here. goodbye and thank you see what for the next week

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.