[R] weird pasting of ".value" when list is returned
markleeds at verizon.net
markleeds at verizon.net
Sat Dec 13 07:54:04 CET 2008
could someone explain why the name of FPVAL gets " .value" concatenated
onto it when the code below is run and temp is returned.
I've been trying to figure this out for too long. It doesn't matter when
I put the FPVAL in the return statement. It happens regardless of
whether it's first or last. Thanks.
f.lmmultenhanced <-
function(response, pred1, pred2)
{
regmod <- lm(response ~ pred1 + pred2)
lmsum <- summary(regmod)
imbcoef<-lmsum$coefficients[2,1]
retcoef<-lmsum$coefficients[3,1]
imbpval<-lmsum$coefficients[2,4]
retpval<-lmsum$coefficients[3,4]
Fstat<-lmsum$fstatistic[1]
fpval<-pf(Fstat,lmsum$fstatistic[2],lmsum$fstatistic[3],lower=FALSE)
return(list(categrsp=response,pred1=pred1,pred2=pred2,regmod=regmod,
rest=c("FPVAL"=fpval,"IMBCOEF"=imbcoef,"RETCOEF"=retcoef,"IMBPVAL"=imbpval,"RETPVAL"=retpval)
))
}
x <- 10 + 1:100
y <- 5 + seq(2,200,by=2)
z <- 2*x + 3*y + rnorm(100)
temp <- f.lmmultenhanced(x,y,z)
print(temp)
More information about the R-help
mailing list