[R] What is the most useful way to detect nonlinearity in lo

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Dec 5 23:45:44 CET 2004


(Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> writes:

> >> x <- runif(500)
> >> y <- rbinom(500,size=1,p=plogis(x))
> >> xx <- predict(loess(resid(glm(y~x,binomial))~x),se=T)
> >> matplot(x,cbind(xx$fit, 2*xx$se.fit, -2*xx$se.fit),pch=20)
> >> 
> >> Not sure my money isn't still on the splines, though.
.....
> > Serves me right for posting way beyond my bedtime...
> 
> Hi Peter,
> 
> Yes, the above is certainly misleading (try it with 2000 instead
> of 500)! But what would you suggest instead?

(I did and this little computer came tumbling down...). 

Basically, I'd reconsider the type= option to residual.glm. As I said,
at least type="response" should have the right mean. Ideally, you'd
want to take advantage of the fact that the variance of the residuals
is known too, rather than have the smoother estimate it. The more I
think, the more I like the splines...


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list