0% found this document useful (0 votes)
2 views

3-Applying multiple linear Regression

The document outlines an experiment on multiple linear regression, applying it to real datasets to compute and interpret coefficients of determination. It includes examples of regression models for product sales influenced by advertising and salespersons, as well as BMR based on age, height, weight, and BMI. Additionally, it provides instructions for further practice problems related to multiple regression analysis.

Uploaded by

rahul467321
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

3-Applying multiple linear Regression

The document outlines an experiment on multiple linear regression, applying it to real datasets to compute and interpret coefficients of determination. It includes examples of regression models for product sales influenced by advertising and salespersons, as well as BMR based on age, height, weight, and BMI. Additionally, it provides instructions for further practice problems related to multiple regression analysis.

Uploaded by

rahul467321
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

EXPERIMENT-3

Multiple Linear Regression


Applying multiple linear Regression model to real dataset;
computing and interpreting the multiple coefficients of
determination

Diagnostic plots

Problem 3: The sale of a Product in lakhs of rupees(Y) is expected to be influenced


by two variables namely the advertising
number of sales persons(X2) in a region. Sample data on 8 Regions of a state has
given the following results

Area Y X1 X2
1 110 30 11
2 80 40 10
3 70 20 7
4 120 50 15
5 150 60 19
6 90 40 12
7 70 20 8
8 120 60 14

Code:-
> Y=c(110,80,70,120,150,90,70,120)
> X1=c(30,40,20,50,60,40,20,60)
> X2=c(11,10,7,15,19,12,8,14)
> input_data=data.frame(Y,X1,X2)
> input_data
Y X1 X2
1 110 30 11
2 80 40 10
3 70 20 7
4 120 50 15
5 150 60 19
6 90 40 12
7 70 20 8
8 120 60 14
> RegModel <- lm(Y~X1+X2, data=input_data)
> RegModel

Call:
lm(formula = Y ~ X1 + X2, data = input_data)

Coefficients:
(Intercept) X1 X2
16.8314 -0.2442 7.8488

> summary(RegModel)

Call:
lm(formula = Y ~ X1 + X2, data = input_data)
Residuals:
1 2 3 4 5 6 7 8
14.157 -5.552 3.110 -2.355 -1.308 -11.250 -4.738 7.936

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 16.8314 11.8290 1.423 0.2140
X1 -0.2442 0.5375 -0.454 0.6687
X2 7.8488 2.1945 3.577 0.0159 *
---

Residual standard error: 9.593 on 5 degrees of freedom


Multiple R-squared: 0.9191, Adjusted R-squared: 0.8867
F-statistic: 28.4 on 2 and 5 DF, p-value: 0.001862

Interpretation :
Now the regression the regression model is
Y 16.834 0.2442* X 1 7.8488* X 2
Since R2 is 0.9593 and the ANOVA shows that the F-ratio is significant, this model
can be taken as good-fit in explaining the sales interms of the other two variables.

Problem 4 :( Health.csv) Let us develop a multiple regression model of BMR on the


variables age, HT, WT and BMI and interpret the data
Code:-
Interpretation:-
Now the Regression model can be stated as
BMR 2500.492 4.021(age) 17.293( HT ) 1.1019 50.553( BMI )

R2 is 0.8701 ,which is about 87% of BMR can be explained in terms of age HT,WT
and BMI of a person through this linear model, we also see that all the explanatory
variables have positive relationship with BMR. These regression coefficient are how
ever not statistically significant except that of age, though the F-test in ANOVA shows
that the overall regression is significant at 0.01 level(p-value is almost zero).The
meaning of the regression coefficient can be understood as follows
if the age increases by 4.021 at fixed values of the other factors like HT,WT and BMI.
Problem 5:( Agriculturedata.csv)
Write the model and interpret about that model for the fallowing Code:

R code:-

>input_data<-read.csv('C:/Users/10526/Desktop/Moksha_New/
Agriculturedata.csv')
>input_data
>summary(input_data)
>cor(input_data[,c("Net_Agricultural_Output","Population_Active_in_Agricult
ure","Fertilizer_Consumption","Number_of_Tractors_in_Agriculture")],
use="complete.obs")
>RegModel.2 <-
lm(Net_Agricultural_Output~Population_Active_in_Agriculture+Fertilizer_Co
nsumption, data=input_data)
>summary(RegModel.2)
>plot(RegModel.2)

Practice problems :-

1. For the given details viz. Sector wise Number of Factories, Productive
Capital, No. of Employees, Total Output and Net Value Added Fit the
Multiple Regression and interpret your result. Assume the variables as
Dependent and Independent according to your requirement/description. File
Name: Ex 3 data file.

2. Use the Life Satisfaction dataset to fit the regression equation. File Name:
Ex 1 and 4 data file.

You might also like