[Rd] predict.lm(...., se=T), with 1-column model matrix (PR#1018)

john.maindonald@anu.edu.au john.maindonald@anu.edu.au
Sun, 8 Jul 2001 12:22:05 +0200 (MET DST)


#       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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._