I am curious about the reason for the following:> xzw<-lm(y ~ x+cbind(z,w)) > names1<-names(xzw$coefficients) > names1[1] "(Intercept)" "x" "cbind(z, w)z" "cbind(z, w)w"> names2<-colnames(as.matrix(xzw$model)) > names2[1] "y" "x" "cbind(z, w).z" "cbind(z, w).w"> names1==names2[1] FALSE TRUE FALSE FALSE It would be helpful for some purposes if all components except the first here could be TRUE. Presumably there is some good reason for the difference? Can someone please enlighten me? -- David Firth Phone +44 1865 278544 Nuffield College Fax +44 1865 278621 Oxford OX1 1NF Secretary +44 1865 278553 United Kingdom Email david.firth at nuffield.ox.ac.uk http://www.stats.ox.ac.uk/~firth/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 28 Sep 2001, David Firth wrote:> I am curious about the reason for the following: > > > xzw<-lm(y ~ x+cbind(z,w)) > > names1<-names(xzw$coefficients) > > names1 > [1] "(Intercept)" "x" "cbind(z, w)z" "cbind(z, w)w" > > names2<-colnames(as.matrix(xzw$model)) > > names2 > [1] "y" "x" "cbind(z, w).z" "cbind(z, w).w" > > names1==names2 > [1] FALSE TRUE FALSE FALSE > > It would be helpful for some purposes if all components except the > first here could be TRUE. Presumably there is some good reason for > the difference? Can someone please enlighten me?xzw$model is the model frame: xzw$coefficients refers to the model matrix. With factors in the model they are very different. I guess you wanted a linear model fit with x=TRUE and xzw$x, as it y <- rnorm(100) x <- rnorm(100) z <- rnorm(100) w <- rnorm(100) xzw<-lm(y ~ x+cbind(z,w), x = TRUE) colnames(xzw$x) [1] "(Intercept)" "x" "cbind(z, w)z" "cbind(z, w)w" Further, be careful of calling xzw$coefficients rather than coef(xzw). You will not always get the same thing with other fitting functions. Brian -- Brian D. Ripley, ripley at 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-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear R-announce list members, I've just uploaded to CRAN a substantially revised version (0.6-0) of the sem (structural-equations model) package. The new version uses a formula for the gradient to fit generalized SEMs, and also allows symbolic specification of the model. As always, comments and suggestions are appreciated. John ----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: jfox at mcmaster.ca phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox ----------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-announce 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-announce-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._