On Sat, 13 Dec 2008, markle...@verizon.net wrote:

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.

Mark,


It is because the sole element of fpval is named 'value'. Check this:

foo<-function() return(list(a=1,b=c(x=c(value=1),y=c(nother.name=2))))
foo()
$a
[1] 1

$b
      x.value y.nother.name
            1             2

HTH,

Chuck


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)

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Charles C. Berry                            (858) 534-2098
                                            Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu               UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to