ripley@stats.ox.ac.uk
2000-Aug-07 18:43 UTC
[Rd] predict.lm is broken in 1.1.0-patched (2000-August-7) (PR#626)
predict.lm has been broken by recent changes to the patched branch. It fails for all singular fits. An example: library(MASS) data(quine) quine.hi <- aov(log(Days + 2.5) ~ .^4, quine) quine.nxt <- update(quine.hi, . ~ . - Eth:Sex:Age:Lrn) predict(quine.nxt) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 141 142 143 144 145 146 NA NA NA NA NA NA The answeer should be (e.g. R 1.1.0)> predict(quine.nxt)1 2 3 4 5 6 7 8 2.19247 2.19247 2.19247 2.68311 2.68311 2.68311 2.68311 2.68311 9 10 11 12 13 14 15 16 2.37260 2.37260 2.37260 2.53960 2.53960 3.53516 3.53516 3.53516 17 18 19 20 21 22 23 24 3.53516 3.24298 3.24298 3.24298 3.24298 3.24298 3.24298 3.24298 25 26 27 28 29 30 31 32 3.31368 3.31368 3.31368 3.31368 3.31368 3.31368 3.31368 2.03746 ... I believe this is a lot worse than that which the changes were intended to fix. (Are we not supposed to be ultra-cautious about not making things worse in that branch?) --please do not edit the information below-- Version: platform = sparc-sun-solaris2.6 arch = sparc os = solaris2.6 system = sparc, solaris2.6 status Patched major 1 minor 1.0 year 2000 month August day 7 language R Search Path: .GlobalEnv, Autoloads, package:base -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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
2000-Aug-07 19:30 UTC
[Rd] predict.lm is broken in 1.1.0-patched (2000-August-7) (PR#626)
ripley@stats.ox.ac.uk writes:> predict.lm has been broken by recent changes to the patched branch. > > It fails for all singular fits. An example: > > library(MASS) > data(quine) > quine.hi <- aov(log(Days + 2.5) ~ .^4, quine) > quine.nxt <- update(quine.hi, . ~ . - Eth:Sex:Age:Lrn) > predict(quine.nxt) > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 > NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA...> I believe this is a lot worse than that which the changes were intended to > fix. (Are we not supposed to be ultra-cautious about not making things > worse in that branch?)Sometimes the fix for one bug uncovers another. We have> coef.aovfunction (object, ...) { z <- object$coef z[!is.na(z)] }> coef.lmfunction (object, ...) object$coefficients and both of these cannot be right when predict.lm calls coef(object) and object$coefficients contains NA's. Using object$coefficients inside predict.lm fixes things, but I'm still not happy with the two different conventions for coef... -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._