-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathE04-dcopa.R
43 lines (27 loc) · 1020 Bytes
/
E04-dcopa.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
library(car)
dades <- read.csv2("./Dades/dcopa.csv")
dades$RP<-dades$PB/dades$PT
dades$LDCopa<-log(dades$DCopa)
dades$LRP<-log(dades$RP)
dades$LPT<-log(dades$PT)
dades$LHT<-log(dades$HT)
dades$LE<-log(dades$E)
summary(modAc<-lm(DCopa~I(PB/PT)+PT+HT+E,dades))
summary(modA<-lm(DCopa~RP+PT+HT+E,dades))
plot(predict(modA),resid(modA),pch=3)
abline(h=0,lty=2)
plot(modA,ask=F)
plot(rstudent(modA),pch=3)
abline(h=c(-3,-2,0,2,3),lty=2)
summary(modBc<-lm(log(DCopa)~log(PB/PT)+log(PT)+log(HT)+log(E),dades))
summary(modB<-lm(LDCopa~LRP+LPT+LHT+LE,dades))
plot(predict(modB),resid(modB),pch=3)
abline(h=0,lty=2)
plot(modB,ask=F)
plot(rstudent(modB),pch=3)
abline(h=c(-3,-2,0,2,3),lty=2)
dp0<-data.frame(PT=c(0.4,0.64),PB=c(0.6,0.9),HT=c(2.3,2.8),E=10)
dpb<-data.frame(LPT=c(0.4,0.64),LRP=log(c(0.6,0.9)/c(0.4,0.64)),LHT=log(c(2.3,2.8)),LE=log(10))
exp(predict(modB,dpb,interval="prediction",level=0.9))
exp(predict(modBc,dp0,interval="prediction",level=0.9))
predict(modAc,dp0,interval="prediction",level=0.9)