[R-sig-dyn-mod] R-sig-dynamic-models Digest, Vol 80, Issue 1

Thomas Petzoldt thomas.petzoldt at tu-dresden.de
Thu Dec 18 12:15:38 CET 2014


Hi,

after looking at you data again, cubic root transformation seems to
remove non-linearity and to improve variance homogeneity of residuals:

dat <- data.frame(
   EFW=c(132,210,1796,125,591,88,104,284,1150,
     449,2221,1953,1146,204,2797,840,224,3711,110,93,320,2449,
     2062,277,2577,2644,81,73,560,600,158,864,2660,132,210,1592,
     121,591,88,104,284,1304,781,1737,101,1191,1326,1015,173,
     1096,76,198,145,97,3881,1388,2849,701,355,2432,1174,244,
     3063,3945,1641,1570,3649,3268,515,3376,2560,861,545,494,
     2745,499,92,591,132,1070,1149,2449,919,376,132,447,71),
   GA=c(15,18,32,15,23,14,14,19,28,21,34,32,28,17,37,26,18,
     40,15,14,20,35,33,19,36,36,14,13,23,23,16,26,35,15,18,
     31,15,23,14,14,19,29,25,32,14,28,29,27,17,28,13,17,16,
     14,40,29,36,24,20,35,28,18,37,41,31,30,39,38,22,38,35,
     26,23,22,36,22,14,23,16,28,31,35,26,21,16,22,13)
)

x <- dat$GA
y <- dat$EFW ^ (1/3)

m <- lm(y ~ x)
summary(m)

## check essential assumptions
plot(m, which = 1) # homogeneity of residuals
plot(m, which = 2) # normality of residuals

## 90% intervals
new <- data.frame(x=seq(min(x), max(x), length=100))

pred.w.plim <- predict(m, new, interval = "prediction", level=0.9)
pred.w.clim <- predict(m, new, interval = "confidence", level=0.9)
matplot(new$x, cbind(pred.w.clim, pred.w.plim[,-1]),
         lty = c(1,2,2,3,3), type = "l", xlab = "GA",
         ylab = "EFW^(1/3)", col=c(1,2,2,3,3))

points(y ~ x)



It's up to you how to deal with the remaining outlier ...

Thomas

PS: such questions next time to r-help, please.



More information about the R-sig-dynamic-models mailing list