Solution: have package mgcv loaded when you predict...not just for the fit. :) Silly mistake...
Thanks Simon! Ben On Thu, May 3, 2012 at 3:56 PM, Ben quant <ccqu...@gmail.com> wrote: > Hello, > > I don't understand what went wrong or how to fix this. How do I set > qr=TRUE for gam? > > When I produce a fit using gam like this: > > fit = gam(y~s(x),data=as.data.frame(l_yx),family=family,control = > list(keepData=T)) > > ...then try to use predict: > (see #1 below in the traceback() ) > > > traceback() > 6: stop("lm object does not have a proper 'qr' component.\n Rank zero or > should not have used lm(.., qr=FALSE).") at #81 > 5: qr.lm(object) at #81 > 4: summary.glm(object, dispersion = dispersion) at #81 > 3: summary(object, dispersion = dispersion) at #81 > 2: predict.glm(fit, data.frame(x = xx), type = "response", se.fit = T, > col = prediction_col, lty = prediction_ln) at #81 > 1: predict(fit, data.frame(x = xx), type = "response", se.fit = T, > col = prediction_col, lty = prediction_ln) at #81 > > ...I get this error: > > Error in qr.lm(object) : lm object does not have a proper 'qr' component. > Rank zero or should not have used lm(.., qr=FALSE). > > I read this post: http://tolstoy.newcastle.edu.au/R/devel/06/04/5133.html > > So I tried adding qr=T to the gam call but it didn't make any difference. > This is how I did it: > > fit = gam(y~s(x),data=as.data.frame(l_yx),family=family,control = > list(keepData=T),qr=T) > > Its all very strange because I've produced fits with this data may times > before with no issues (and never having to do anything with the qr > parameter. I don't understand why this is coming up or how to fix it. > > PS - I don't think this matters, but I am calling a script called > FunctionGamFit.r like this: > err = system(paste('"C:\\Program Files\\R\\R-2.14.1\\bin\\R.exe"', 'CMD > BATCH FunctionGamFit.r'), wait = T) > ...to produce the fit. > > Thanks for any help! > > ben > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.