Answer To: Please use R to solve these problems and provide in PDF solution formt
Suraj answered on Mar 07 2021
Assignment
Topic: Linear Regression using R
Submitted To:
Submitted BY:
Date: 06/03/2021
Solution 2:
Assume that the assumptions of the linear regression hold and regression model is fitted to the data. The typical regression model will look like as follows:
Now, we have added one new data point to the data and once again fit the regression model. Then the value of the intercept term will increase, the value of slope will decrease. Also, the values of the standard error for both coefficients will decrease.
Solution 4:
The regression equation to predict the height of adult at age 2 is given as follows:
The slope of the regression line is 2.1. which states that a 1 unit increase in the independent variable the dependent variable is increase by value 2.1.
The 90% confidence interval for slope is given as follows:
.
Interpretation: We are 90% confident that the value of the slope for regression line will always lies between 1.9 and 2.3.
Solution 5:
The regression line for the independent variable weekly usage (hours) and dependent variable annual maintenance expense is given as follows:
a)
The R code is given as follows:
x<-c(13,10,20,28,32,17,24,31,40,38)
y<-c(17,22,30,37,47,30.5,32.5,39,51.5,40)
reg<-lm(y~x)
summary(reg)
The output is given as follows:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.5280 3.7449 2.811 0.022797
Weekly Usage 0.9534 0.1382 6.901 0.000124
Thus, the regression line is given as follows:
Annual maintenance expense = 10.5280 + 0.9534*weekly usage
b)
The test for significance of the slope coefficient is given as follows:
The hypotheses are,
The test statistic,
From the above output, the p-value for the weekly usage is 0.000124 i.e. 0. Thus, the p-value is less than the level of significance 0.05. Hence, the null hypothesis is rejected and concluded that the slope coefficient is significant.
c)
The prediction for 30 hours usage is given as follows:
Annual maintenance expense = 10.5280 + 0.9534*30
= 39.13
The confidence interval for the dependent variable is given as follows:
MSE = 43.56
d)
The maintenance cost is $3300 i.e. 33. The value 33 lies in the 95% confidence interval. Thus, we recommend to purchase it.
Solution 6:
The output is given as follows:
The slope for the model is -4.5098. Thus, for a unit increase in the temperature, the dependent variable cost of heating is decrease by value -4.5098.
Solution 7:
For the regression equation, the t-value for the slope is -3.1.
More information is needed to answer this question. Information is missing.
Need sample size and standard deviation or standard error value.
Solution 10:
a)
The data is generated with following R code:
set.seed(5)
x<-rnorm(100)
y<-2*x+rnorm(100)
model<-lm(y~x+0)
summary(model)
The regression equation without intercept term is given as follows:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
x 2.1336 0.1104 19.33<2e-16 ***
The slope for the regression equation is 2.1336.
The standard error for the slope is 0.1104.
The t-value for the test is 19.33 and the p-value is approximately 0.
The hypotheses are,
Here, the p-value is less...