john.maindonald@anu.edu.au
2001-Jul-08 10:22 UTC
[Rd] predict.lm(...., se=T), with 1-column model matrix (PR#1018)
# r-bugs@r-project.org The problem occurs when the model matrix has a single column.> elastic <- data.frame(stretch=c(46,54,48,50,44,42,52),distance=c(183,217,189,208,178,150,249))> elastic.lm <- lm(distance ~ -1 + stretch, data=elastic)> predict(elastic.lm,se=T)Error in XRinv^2 %*% rep(res.var, p) : non-conformable arguments The fix is to replace XRinv <- qr.Q(object$qr)[, p1] with XRinv <- qr.Q(object$qr)[, p1, drop=FALSE] The statement is five lines above XRinv^2 %*% rep(res.var, p) John Maindonald. --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = x86 os = Win32 system = x86, Win32 status = major = 1 minor = 3.0 year = 2001 month = 06 day = 22 language = R Windows ME 4.90 (build 3000) Search Path: .GlobalEnv, package:ctest, Autoloads, package:base John Maindonald email : john.maindonald@anu.edu.au Statistical Consulting Unit, phone : (6125)3473 c/o CMA, SMS, fax : (6125)5549 John Dedman Mathematical Sciences Building Australian National University Canberra ACT 0200 Australia -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2001-Jul-08 12:05 UTC
[Rd] predict.lm(...., se=T), with 1-column model matrix (PR#1018)
john.maindonald@anu.edu.au writes:> # r-bugs@r-project.org > > The problem occurs when the model matrix has a single > column. > > > elastic <- data.frame(stretch=c(46,54,48,50,44,42,52), > distance=c(183,217,189,208,178,150,249)) > > elastic.lm <- lm(distance ~ -1 + stretch, data=elastic) > > > predict(elastic.lm,se=T) > Error in XRinv^2 %*% rep(res.var, p) : non-conformable arguments > > The fix is to replace > XRinv <- qr.Q(object$qr)[, p1] > with > XRinv <- qr.Q(object$qr)[, p1, drop=FALSE] > > The statement is five lines above XRinv^2 %*% rep(res.var, p) >Ick! Thanks. For a workaround, notice that> predict(elastic.lm,se=T,new=elastic)$fit 1 2 3 4 5 6 7 188.8946 221.7458 197.1074 205.3202 180.6818 172.4690 213.5330 $se.fit [1] 6.423642 7.540797 6.702930 6.982219 6.144353 5.865064 7.261508 $df [1] 6 $residual.scale [1] 17.79576 -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._