Docsity

Statistics Assignment, Assignments of Statistics

Partial preview of the text

Download Statistics Assignment and more Assignments Statistics in PDF only on Docsity!

Homework

Question 2a

X <- c (12,12,16,16,16,20,20,20,24,24,24,28,28) Y <- c (130.5,129.6,142.5,140.3,143.4,145.2,144.9,144.2,147.8,146.6,148.4,134.8,135.1) model <- lm (Y ~ X + I (X ห† 2)) summary (model)

Call:

lm(formula = Y ~ X + I(X^2))

Residuals:

Min 1Q Median 3Q Max

-2.6850 -1.5205 -0.1387 1.5334 3.

Coefficients:

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

(Intercept) 52.06146 8.91421 5.840 0.000164 ***

X 9.07099 0.92981 9.756 1.99e-06 ***

I(X^2) -0.21649 0.02307 -9.382 2.84e-06 ***

---

Signif. codes: 0 โ€™โ€™ 0.001 โ€™โ€™ 0.01 โ€™โ€™ 0.05 โ€™.โ€™ 0.1 โ€™ โ€™ 1

Residual standard error: 2.113 on 10 degrees of freedom

Multiple R-squared: 0.9102, Adjusted R-squared: 0.

F-statistic: 50.68 on 2 and 10 DF, p-value: 5.838e-

Question 2b

The coefficient for X , ฮฒ ห† 1 , represents the instantaneous rate of change in yield for a one-unit increase in planting rate, assuming X^2 is held constant. However, since this is a quadratic model, ฮฒ 1 alone does not capture the full marginal effect, which depends on both X and X^2.

Question 2c

Y_adj <- Y - 9 ***** X X2 <- X ห† 2

model_revised <- lm (Y_adj ~ X2)

summary (model_revised)

Call:

lm(formula = Y_adj ~ X2)

Residuals:

Min 1Q Median 3Q Max

-2.6376 -1.5767 -0.2116 1.5570 3.

Coefficients:

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

(Intercept) 52.734411 1.268440 41.57 1.9e-13 ***

X2 -0.214742 0.002666 -80.55 < 2e-16 ***

---

Signif. codes: 0 โ€™โ€™ 0.001 โ€™โ€™ 0.01 โ€™โ€™ 0.05 โ€™.โ€™ 0.1 โ€™ โ€™ 1

Residual standard error: 2.016 on 11 degrees of freedom

Multiple R-squared: 0.9983, Adjusted R-squared: 0.

F-statistic: 6488 on 1 and 11 DF, p-value: < 2.2e-

Question 2f

B <- 1000

n <- length (X) x_star_vals <- numeric (B)

for (i in 1 : B) { idx <- sample (1 : n, replace = TRUE) Xb <- X[idx] Yb <- Y[idx]

model_boot <- lm (Yb - 9 ***** Xb ~ I (Xb ห† 2)) beta_b_hat <- coef (model_boot)[2]

x_star_vals[i] <- - 9 / (2 ***** beta_b_hat) }

ci_boot <- quantile (x_star_vals, probs = c (0.025, 0.975)) print (ci_boot)