In: Statistics and Probability
part b)
x=rnorm(n = 1000,mean = 0,sd = 1)
epsilon = rnorm(n=1000,mean = 0,sd = 2)
y = 0.5+ 2*x+ epsilon
summary(y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-7.5327 -1.3857 0.5624 0.5317 2.4416 10.5398
plot(x,y)c) model.linear = lm(y~x)
summary(model.linear)
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-6.5487 -1.4064 -0.0183 1.3948 7.4133
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.38311 0.06352 6.031 2.29e-09 ***
x 2.00601 0.06510 30.813 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.003 on 998 degrees of freedom
Multiple R-squared: 0.4875, Adjusted R-squared: 0.487
F-statistic: 949.5 on 1 and 998 DF, p-value: < 2.2e-16
d) the magnitude of slope is showing positvely correlated with the response variate. and R square just 48.7 percent only contributing in the response of predictor variable.
e) i m guessing PCE as response variable and PDI as predictor variable are correlated to each other.based on the given information. i am giving you two reason for that
1) error and independent variable are orthogonal means independent to each other.
2) to check autocorrelation of error terms # so there is no autocorrelation in that model
3) similary autocorrelation of response variate.# as above autocorrelation
4)Spurious regression happens when there are similar local trends.# no trend in that model.