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]]
Which version of gam are you using (i.e. which package and version number?) prediction with fitted gam objects should call predict.gam, and I'm not quite sure why this is not happening here (you do have the mgcv or gam loaded while trying to predict, I suppose?). On 03/05/12 22:56, Ben quant 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 at 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. >-- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283
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 <ccquant@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]]
Possibly Parallel Threads
- gam, what is the function(s)
- gam - Y axis probability scale with confidence/error lines
- logistic regression - glm.fit: fitted probabilities numerically 0 or 1 occurred
- QR Decompositon and qr.qty
- qr.qy and qr.qty give an error message when y is integer and LAPACK=TRUE