Question

In: Statistics and Probability

Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can...

Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can be found on Canvas). Now fit a simple linear regression model with X = lotSize and Y = workHrs. Summarize the output from the model: the least square estimators, their standard errors, and corresponding p-values. b. Draw the scatterplot of Y versus X and add the least squares line to the scatterplot. c. Obtain the fitted values ˆyi and residuals ei . Print the first 5 fitted values and the corresponding residuals.

lotSize workHrs

80 399

30 121

50 221

90 376

70 361

60 224

120 546

80 352

100 353

50 157

40 160

70 252

90 389

20 113

110 435

100 420

30 212

50 268

90 377

110 421

30 273

90 468

40 244

80 342

70 323

Solutions

Expert Solution

Given data

Toluca

x

y

80

399

30

121

50

221

90

376

70

361

60

224

120

546

80

352

100

353

50

157

40

160

70

252

90

389

20

113

110

435

100

420

30

212

50

268

90

377

110

421

30

273

90

468

40

244

80

342

70

323

Answer(a): the least square estimators, their standard errors, and corresponding p-values

Coefficients:

Estimate

Std.

Error

t

value Pr(>|t|)

(Intercept)

62.366

26.177

2.382

0.0259

*

x

3.57

0.347

10.29

4.45E-10

***

Answer(b): scatterplot of Y versus X and the least squares line to the scatterplot

Answer(C): First five fitted values yi and residuals ei

y

y fitted

errors

399

347.982

51.01798

121

169.4719

-48.4719

221

240.876

-19.876

376

383.684

-7.68404

361

312.28

48.72


Related Solutions

ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing...
ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing the level in feet of Lake Huron from 1872- 1972. To assign the values into an ordinary vector,x, we can do the following 'x <- as.vector(LakeHuron)'. From there, we can access the data easily. Assume the values in X are a random sample from a normal population with distribution X. Also assume the X has an unknown mean and unknown standard deviation. With this...
Curve-fitting Project - Linear Model Instructions For this assignment, collect data exhibiting a relatively linear trend,...
Curve-fitting Project - Linear Model Instructions For this assignment, collect data exhibiting a relatively linear trend, find the line of best fit, plot the data and the line, interpret the slope, and use the linear equation to make a prediction. Also, find r2 (coefficient of determination) and r (correlation coefficient). Discuss your findings. Your topic may be that is related to sports, your work, a hobby, or something you find interesting. If you choose, you may use the suggestions described...
In section 2.1 you read about how we can model certain situations using linear equations. In...
In section 2.1 you read about how we can model certain situations using linear equations. In particular, example 8 shows how you can create an equation to predict sales of a company Pick a company whose sales you want to model and predict. Look up their sales information and pick 2 years of data. Using that information, create a linear equation that can be used to predict the sales of the company. Once you have your equation, predict the sales...
Using R Question 3. kNN Classification 3.1 Read in iris dataset using “data(iris)”. Describe the features...
Using R Question 3. kNN Classification 3.1 Read in iris dataset using “data(iris)”. Describe the features in the data using summary 3.2 Randomize the iris data set, mix it up and normalize it 3.3 split data into training & testing (70/30 split) 3.4 Train model in data and use crosstable function to evaluate the results 3.5 Rerun your code for K=10 and 100. Compare results and explain
a. Using the following R codes to fit the linear regression model for VitC on HeadWt,...
a. Using the following R codes to fit the linear regression model for VitC on HeadWt, and obtain its summary. Paste the R output in your homework. cabbages_data <- read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv") cabbages_reg <- lm(VitC ~ HeadWt, data = cabbages_data) summary(cabbages_reg) b. State and interpret the value of r 2 from the model summary output in part a). c. Calculate the correlation r between HeadWt and VitC, and state the strength and the direction of the correlation. d. State the estimated regression...
Using the following R codes to fit the linear regression model for VitC on HeadWt, and...
Using the following R codes to fit the linear regression model for VitC on HeadWt, and obtain its summary. Paste the R output in your homework. cabbages_data <- read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv") cabbages_reg <- lm(VitC ~ HeadWt, data = cabbages_data) summary(cabbages_reg)
a. Using the following R codes to fit the linear regression model for VitC on HeadWt,...
a. Using the following R codes to fit the linear regression model for VitC on HeadWt, and obtain its summary. Paste the R output in your homework. cabbages_data <- read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv") cabbages_reg <- lm(VitC ~ HeadWt, data = cabbages_data) summary(cabbages_reg) b. State and interpret the value of r 2 from the model summary output in part a). c. Calculate the correlation r between HeadWt and VitC, and state the strength and the direction of the correlation. d. State the estimated regression...
Using the Motor Trend Car Road Tests dataset mtcars, in faraway R package, fit a model...
Using the Motor Trend Car Road Tests dataset mtcars, in faraway R package, fit a model with mpg: Miles/(US) gallon as the response and the other variables as predictors. (a) Which variables are statistically significant at the 5% level? For each and every test provide the null and alternative hypotheses, critical region (or rejection region), test statistics and your conclusions. (30) (b) What interpretation should be given to the coefficient for vs: Engine? (3) (c) Compute 90 and 95% confidence...
Chapter 9, Section 1, Exercise 005 Computer output for fitting a simple linear model is given...
Chapter 9, Section 1, Exercise 005 Computer output for fitting a simple linear model is given below. State the value of the sample slope for the given model. In testing if the slope in the population is different from zero, identify the p-value and use it (and a 5 % significance level) to make a clear conclusion about the effectiveness of the model. The regression equation is Y ⁢=87.0 -6.9 X . Predictor Coef SE Coef T P Constant 87.013...
Chapter 9, Section 1, Exercise 006 Computer output for fitting a simple linear model is given...
Chapter 9, Section 1, Exercise 006 Computer output for fitting a simple linear model is given below. State the value of the sample slope for this model and give the null and alternative hypotheses for testing if the slope in the population is different from zero. Identify the p-value and use it (and a 5% significance level) to make a clear conclusion about the effectiveness of the model. The regression equation is Y⁢=83.2-0.0133X. Predictor Coef SE Coef T P Constant...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT