# Regression Line and Confidence Intervals using R

See the attached file.

The question asks to fit a regression line for an independent variable and its dependent variable response.

Data needs to be plotted in R (with code) and regression line.

Confidence intervals for different responses is also needed.

Here X is the predictor (independent variable), and Y is the response (dependent variable).

(a) Fit a regression line, and provide estimates for the intercept ?0, the slope ?1, and the residual standard deviation ?.

(b) Plot the data, and show the regression line.

(c) What is the expected response for X = 60? What is the expected response for X = 70? Provide 95% confidence intervals.

(d) For both X = 60 and X = 70, provide 95% prediction intervals.

(e) Comment on the lengths of the four intervals.

Data:

Y=c(

541,524,561,414,410,457,344,467,464,498,580,471,525,508,566,635,603,714,865,

640,649,540,464,547,460,566,577,631,574,534,571,554,577,628,487,644,640,704,

648,968,587,699,632,591,782,510,610,524)

X=c(

52.5,57.2,58.0,52.9,54.4,57.1,45.1,55.3,52.9,55.2,53.0,52.5,57.4,54.5,60.8,

58.6,57.2,54.0,72.4,67.7,66.3,60.2,51.1,51.7,55.1,54.4,54.8,57.9,56.3,49.3,

51.8,51.3,57.8,54.7,48.7,62.9,56.6,58.6,66.3,67.2,62.6,56.3,60.3,50.8,67.2,

57.1,62.3,59.3).

https://brainmass.com/statistics/regression-analysis/regression-line-confidence-intervals-using-476617

#### Solution Preview

> Y=c(

+ 541,524,561,414,410,457,344,467,464,498,580,471,525,508,566,635,603,714,865,

+ 640,649,540,464,547,460,566,577,631,574,534,571,554,577,628,487,644,640,704,

+ 648,968,587,699,632,591,782,510,610,524)

> X=c(

+ 52.5,57.2,58.0,52.9,54.4,57.1,45.1,55.3,52.9,55.2,53.0,52.5,57.4,54.5,60.8,

+ 58.6,57.2,54.0,72.4,67.7,66.3,60.2,51.1,51.7,55.1,54.4,54.8,57.9,56.3,49.3,

+ 51.8,51.3,57.8,54.7,48.7,62.9,56.6,58.6,66.3,67.2,62.6,56.3,60.3,50.8,67.2,

+ 57.1,62.3,59.3)

> model = lm(Y~X)

> summary(model)

Call:

lm(formula = Y ~ X)

Residuals:

Min 1Q Median 3Q Max

-129.65 -60.53 -13.03 58.57 247.90

Coefficients:

Estimate Std. Error t value ...

#### Solution Summary

Regression line and confidence intervals using R is provided in the solution.