Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. We wish to fit a linear regression analysis in which the response is estimate

ID: 3063430 • Letter: 1

Question

1. We wish to fit a linear regression analysis in which the response is estimated plant- available phosphonus (PAphos) in 18 lowa soils at 20°C in parts per million, and the two explanatory variables are inorganic phosphorus (inorg) and organic phosphorus (org) The R commands for reading in the data and plotting the data are given belkow PAphos c(64,60,71,61,54,77,81,93,93,51,76,96,77,93,95,54, 168,99) inorg 23.1,21.6,23.1,1.9,26,8,29.9 > par(nfro c(1,2)) plot (org, PAphos,xlab-"Organic phosphate", ylab- "Plant available phosphate 0 5 10 20 30 20304050 60 Incrganic phosphate Organic phosphate (a) Fit the three different normal linear models in R corresponding to: (i) The plant-available phosphorous linearly regressed on inorganic phosphorous; (ii) The plant-available phosphorous linearly regressed on organic phosphorous; ii) The plant-available phosphorous linearly regressed on both inorganic and or- ganic phosphorous. You should provide both your R commands and the associated R outp. This is most casily done by simply cutting and pasting the R commands/output into an (b) Which of the three models would you use for further analyses? Justify your an- 12 (c) For the favoured model state the fitted regression model for the expected response. [1] (d) For model (i) above calculate a 95% interval for the slope of the regression line. [2 2 (e) State the underlying assumptions made in these analyses.

Explanation / Answer

a)

# RCODE

PAphos <- c(64,60,71,61,54,77,81,93,93,51,76,96,77,93,95,54,168,99)
inorg <- c(0.4,0.4,3.1,0.6,4.7,1.7,9.4,10.1,11.6,12.6,10.9,23.1,23.1,21.6,23.1,1.9,26.8,29.9)
org <- c(53,23,19,34,24,65,44,31,29,58,37,46,50,44,56,36,58,51)

model1<-lm(PAphos~inorg)
summary(model1)

model2<- lm(PAphos~org)
summary(model2)

model3<-lm(PAphos~ inorg+org)
summary(model3)

R Output

model1<-lm(PAphos~inorg)

> summary(model1)

Call:

lm(formula = PAphos ~ inorg)

Residuals:

Min 1Q Median 3Q Max

-31.486 -8.282 -1.674 5.623 59.337

Coefficients:

Estimate Std. Error t value Pr(>|t|)   

(Intercept) 59.2590 7.4200 7.986 5.67e-07 ***

inorg 1.8434 0.4789 3.849 0.00142 **

---

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 20.05 on 16 degrees of freedom

Multiple R-squared: 0.4808, Adjusted R-squared: 0.4484

F-statistic: 14.82 on 1 and 16 DF, p-value: 0.001417

> model2<- lm(PAphos~org)

> summary(model2)

Call:

lm(formula = PAphos ~ org)

Residuals:

Min 1Q Median 3Q Max

-41.437 -14.575 -1.646 11.208 75.563

Coefficients:

Estimate Std. Error t value Pr(>|t|)  

(Intercept) 51.7013 20.4469 2.529 0.0224 *

org 0.7023 0.4632 1.516 0.1489  

---

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 26.02 on 16 degrees of freedom

Multiple R-squared: 0.1256, Adjusted R-squared: 0.071

F-statistic: 2.299 on 1 and 16 DF, p-value: 0.1489

> model3<-lm(PAphos~c(inorg,org))

Error in model.frame.default(formula = PAphos ~ c(inorg, org), drop.unused.levels = TRUE) :

variable lengths differ (found for 'c(inorg, org)')

> model3<-lm(PAphos~ inorg+org)

> summary(model3)

Call:

lm(formula = PAphos ~ inorg + org)

Residuals:

Min 1Q Median 3Q Max

-32.828 -8.440 -1.118 6.694 58.757

Coefficients:

Estimate Std. Error t value Pr(>|t|)

(Intercept) 56.25102 16.31074 3.449 0.00358 **

inorg 1.78977 0.55674 3.215 0.00579 **

org 0.08665 0.41494 0.209 0.83740

---

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 20.68 on 15 degrees of freedom

Multiple R-squared: 0.4823, Adjusted R-squared: 0.4133

F-statistic: 6.988 on 2 and 15 DF, p-value: 0.00717

b)

I will choose model with inorganic phosphorous. Because its p-value is less than 0.05 , so significant. Org is not significant.

c)

PAphos = 59.259 + 1.843* inorg

d)

R Code

confint(model1, level = 0.95)

R output

2.5 % 97.5 %
(Intercept) 43.5292859 74.988632
inorg 0.8282098 2.858662

e)

1) Sum of residuals should ve zero

2) Errors should be independent of Y

3) Variance of errors is constant