Iqdata Solved Example
Iqdata Solved Example
V1 V2 V3 V4
> iqdata
> attach(piq)
> attach(iq)
> piq
Error: object 'piq' not found
> attach(iqdata)
> piq
[1] 124 150 128 134 110 131 98 84 147 124 128 124 147 90 96 120 102 84 86 84 134 128 102 131
84
> length(piq)
[1] 38
> length(brain)
[1] 38
> length(height)
[1] 38
> length(weight)
[1] 38
> windows()
> par(mfrow=c(2,3))
> hist(piq)
> plot(brain,piq)
> plot(weight,piq)
> plot(height,piq)
> cor(iqdata)
> fit=lm(piq~brain+height+weight)
> fit
Call:
Coefficients:
> summary(fit)
Call:
Residuals:
Coefficients:
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> student=data.frame(brain,height,weight)
> student
1 90 70 150
> pred=predict(fit,newdata=student)
> pred
105.6356
>