Solution:
> x=runif(1000,0,1)
> y=rnorm(1000,x,(x*x))
> lm(y~x)
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
0.01052 0.98437
> plot(y,x)
> abline(y,x)
> summary(lm(y~x))
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-1.97628 -0.12499 -0.00986 0.12592 2.31425
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.01052 0.02840 0.37 0.711
x 0.98437 0.04935 19.95 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.442 on 998 degrees of freedom
Multiple R-squared: 0.285, Adjusted R-squared: 0.2843
F-statistic: 397.9 on 1 and 998 DF, p-value: < 2.2e-16
5. So far in our linear modeling, we have assumed that Ylz ~ NA,+Az,σ2); that is, there is a normal distribution of common variance around the regression line. Here, we change this up! Suppose that X...
5. So far in our linear modeling, we have assumed that Ylx ~ N(Ao +Ax, σ2); that is, there is a normal distribution of common variance around the regression line. Here, we change this up! Suppose that X~Unif (0, 1) and that for a given a, we know Y~N(x, a2). (Here, the regression line is 0 1r and the variance around the regression grows as a grows.) a. In R, figure out how to generate 1000 data points that follow...