The R Project SVN R

Rev

Rev 15168 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15168 Rev 24397
Line 24... Line 24...
24
sm(predict(fit2))
24
sm(predict(fit2))
25
(pp2 <- predict(fit2, nd))
25
(pp2 <- predict(fit2, nd))
26
 
26
 
27
## same as before: napredict is only applied to predictions on the
27
## same as before: napredict is only applied to predictions on the
28
## original data, following Therneau's original code (and S-PLUS).
28
## original data, following Therneau's original code (and S-PLUS).
-
 
29
## However, as from R 1.8.0 there is a separate na.action arg to predict.lm()
29
stopifnot(all.equal(pp, pp2))
30
stopifnot(all.equal(pp, pp2))
30
 
31
 
31
## should fail
32
## should fail
32
try(fit3 <- lm(Ozone ~ ., data=airquality, na.action=na.fail))
33
try(fit3 <- lm(Ozone ~ ., data=airquality, na.action=na.fail))
33
 
34
 
Line 63... Line 64...
63
gfit2 <- glm(Ozone ~ ., data=airquality, na.action=na.exclude)
64
gfit2 <- glm(Ozone ~ ., data=airquality, na.action=na.exclude)
64
summary(gfit2) # same as before
65
summary(gfit2) # same as before
65
sm(fitted(gfit2))
66
sm(fitted(gfit2))
66
sm(resid(gfit2))
67
sm(resid(gfit2))
67
sm(predict(gfit2))
68
sm(predict(gfit2))
68
(pp2 <- predict(gfit, nd))
69
(pp2 <- predict(gfit2, nd))
69
stopifnot(all.equal(pp, pp2))
70
stopifnot(all.equal(pp, pp2))
70
 
71
 
71
## more precise tests.
72
## more precise tests.
72
f1 <- fitted(gfit)
73
f1 <- fitted(gfit)
73
f2 <- fitted(gfit2)
74
f2 <- fitted(gfit2)