Dear R-users I have a probelm running stepAIC in R1.7.1 I wrote a program which used stepAIC as a part of it, and it worked fine while I was using the previous version of R1.7.0. However, I found the program did not work any more. Now, R produces a message which tells "Error in as.data.frame.default(data) : can't coerce function into a data.frame" every time I run the part of stepAIC. Even the following small program shows the same problem. Is stepAIC of the new version altered? Could anyone help me please? --small example> library(MASS) > x1<-runif(100) > x2<-runif(100) > x3<-runif(100) > x4<-runif(100) > x5<-runif(100) > y<-x1+x2+x3+runif(100) > t<-data.frame(y=y,x1=x1,x2=x2,x3=x3,x4=x4,x5=x5) > x<-lm(y~x1+x2+x3+x4+x5,data=t) > stepAIC(x)Start: AIC= -247.61 y ~ x1 + x2 + x3 + x4 + x5 Df Sum of Sq RSS AIC - x5 1 3.747e-06 7.456 -249.608 - x4 1 0.026 7.483 -249.254 <none> 7.456 -247.609 - x1 1 4.866 12.322 -199.375 - x2 1 8.182 15.639 -175.543 - x3 1 8.597 16.054 -172.922 Error in as.data.frame.default(data) : can't coerce function into a data.frame --------------------------- Hiroto Miyoshi??????? h_m_ at po.harenet.ne.jp
"Hiroto Miyoshi" <h_m_ at po.harenet.ne.jp> writes:> Could anyone help me please? > > --small example >> library(MASS) >> x1<-runif(100) >> x2<-runif(100) >> x3<-runif(100) >> x4<-runif(100) >> x5<-runif(100) >> y<-x1+x2+x3+runif(100) >> t<-data.frame(y=y,x1=x1,x2=x2,x3=x3,x4=x4,x5=x5)It is going to be very unhappy if it tries to call the t() transpose function. Please rename this variable and try again.>> x<-lm(y~x1+x2+x3+x4+x5,data=t) >> stepAIC(x) > Start: AIC= -247.61 > y ~ x1 + x2 + x3 + x4 + x5 > > Df Sum of Sq RSS AIC > - x5 1 3.747e-06 7.456 -249.608 > - x4 1 0.026 7.483 -249.254 > <none> 7.456 -247.609 > - x1 1 4.866 12.322 -199.375 > - x2 1 8.182 15.639 -175.543 > - x3 1 8.597 16.054 -172.922 > Error in as.data.frame.default(data) : can't coerce function into a > data.framebest, -tony -- rossini at u.washington.edu http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}
Hi all! I have a simple question and I hope someone can give me some hints. I have to fit a constrained nonparametric model. More specifically what to do is fiting a monotone spline. Can someone suggest me a (hopely easy :-) ) way or some references to do this with R. I had a look at the R packages but I didn't find any function to do this. Thank you in advance Best, Alessandro
At 09:46 05-10-2003, Hiroto Miyoshi wrote:>Dear R-users > >I have a probelm running stepAIC in R1.7.1 >(...) >--small example >> library(MASS) >> x1<-runif(100) >> x2<-runif(100) >> x3<-runif(100) >> x4<-runif(100) >> x5<-runif(100) >> y<-x1+x2+x3+runif(100) >> t<-data.frame(y=y,x1=x1,x2=x2,x3=x3,x4=x4,x5=x5) >> x<-lm(y~x1+x2+x3+x4+x5,data=t) >> stepAIC(x) >Start: AIC= -247.61 > y ~ x1 + x2 + x3 + x4 + x5 > > Df Sum of Sq RSS AIC >- x5 1 3.747e-06 7.456 -249.608 >- x4 1 0.026 7.483 -249.254 ><none> 7.456 -247.609 >- x1 1 4.866 12.322 -199.375 >- x2 1 8.182 15.639 -175.543 >- x3 1 8.597 16.054 -172.922 >Error in as.data.frame.default(data) : can't coerce function into a >data.frameHiroto, In My computer with R 1.7.1 e R 1.8.0 (win 98 SE) don?t have this error... []s Tura