Answers
> y=c(15,6,9,16,12,18,12,14,14)
> x=c(13,9,12,16,12,16,13,13,18)
> reg=lm(y~x)
> reg
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
-1.676 1.074
#Mothers High school year=-1.167+1.074*Respondent’s highest school year completed
Hence there is linear relationship between two variable.
> cor(y,x)
[1] 0.7929672
Correlation coefficient is 0.79% hence there is higher positive correlation.
> summary(reg)
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-3.6641 -1.9943 0.4847 1.7080 2.7080
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.676 4.303 -0.389 0.7086
x 1.074 0.312 3.443 0.0108 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.381 on 7 degrees of freedom
Multiple R-squared: 0.6288, Adjusted R-squared: 0.5758
F-statistic: 11.86 on 1 and 7 DF, p-value: 0.01079
P_value =0.0108 < 0.05 hence we can say that our regression coefficient is significantly different from zero. therefore Respondent’s highest school year completed is significant variable.
> confint(reg, "x" ,level=0.95)
2.5 % 97.5 %
x 0.3366239 1.812231
Confidence interval is [0.3366239 , 1.812231].