IMBS 1 ISCID-CO Dunkerque/ULCO Mathematics applied to economics and management
Foundations of Descriptive and Inferential Statistics January 2016 - Final assessment - Session 2 - Semester 1 Time allowed : 1h30 - All documents allowed
Exercice 1 Answer: 3.5pts 1. 0.5pt > 1 :20 2. 0.5pt > 20 :1
3. 0.5pt > c(1 :20,19 :1) 4. 0.5pt > tmp<-c(4,6,3) 5. 0.5pt > rep(tmp,10)
6. 0.5pt > c(rep(tmp,10),4) # ou rep(tmp,length.out=31) 7. 0.5pt > rep(tmp,c(10,20,30))
Exercice 2 Answer: 5pts
1. 0.5pt > hills <- read.table("hills.txt") 2. 0.5pt > hills
3. 0.5pt > attach(hills) 4. 0.5pt > plot(dist,time) 5. 0.5pt > lm(time∼dist)
6. 0.5pt > summary(lm(time∼dist)) 7. 0.5pt > abline(lm(time∼dist)) 8. 0.5pt > plot(lm(time∼dist)) 9. 0.5pt > hill.cp<-hills 10. 0.5pt > q()
Exercice 3 Answer: 4pts
0.5pt > height<-c(180,165,160,193) 0.5pt > weight<-c(87,58,65,100)
1pt > BMI<-c(weight/(height/100)∧2) 0.5pt > lnBMI<-log(BMI)
1pt > weightBMIgt25<-weight[BMI>25]
0.5pt > weightBMIgt25
1/2
Exercice 4 Answer: 8.5pts 1. 0.5pt > library(MASS)
0.5pt > data(cats) 0.5pt > cats
0.5pt > attach(cats)
1pt > split(cats,Sex)$M->males
2.
0.5pt > males$Hwt->malesHwt 0.5pt > males$Bwt->malesBwt 0.5pt > plot(malesBwt,malesHwt)
0.5pt Indeed, it looks reasonable to use a linear regression model for the data since its scatterplot is more and less linear.
3. 0.5pt > lm(malesHwt∼malesBwt)->regModel 0.5pt > abline(regModel)
We get the following scatterplot :
2.0 2.5 3.0 3.5
68101214161820
malesBwt
malesHwt
4. 0.5pt > regModel Call :
lm(formula = malesHwt∼malesBwt) Coefficients :
(Intercept) malesBwt -1.184 4.313
0.5pt If two cats differ from ∆BW = 1kg in bodyweight, we may expect a difference equal to ∆HW = 1.184.
0.5pt If two cats differ from ∆BW = 0.1kg in bodyweight, their heart weight will differ from
∆HW = 0.0184g.
5. 1pt > predict(regModel,list(malesBwt=c(3))) 1
11.75395
2/2