[R] model constant relations

Spencer Graves spencer.graves at pdf.com
Mon Nov 10 17:15:45 CET 2003


Thanks very much:  I typed "?summary.fit" when I meant to type 
"?summary.lm", which explains why I didn't find the "cor" argument.  
Thanks also for the reference to "?vcov".  I didn't see that in the "see 
also" section for either "lm" or "summary" or "summary.lm".  Might it be 
worth added? 

Thanks again,
spencer graves

Prof Brian Ripley wrote:

>On Mon, 10 Nov 2003, Spencer Graves wrote:
>
>  
>
>>     Have you looked at the correlation of the parameter estimates? 
>>
>>      In S-Plus, this is automatically produced by summary(lm(...)).  
>>There is probably a simple, elegant way to get this in R, but I don't 
>>know it.  Therefore, I produced it as follows: 
>>    
>>
>
>summary(fit, cor=TRUE) : the default is different between R and S 
>(intentionally).
>
>See also ?vcov.
>
>  
>
>> > DF <- data.frame(x=1:12, y=rep(1:6, each=2))
>> > fit <- lm(y~x, DF)
>> > sumfit <- summary(fit)
>> > cov.fit <- sumfit$cov.unscaled
>> > seb <- sqrt(diag(cov.fit))
>> > cov.fit / outer(seb, seb)
>>            (Intercept)         x
>>(Intercept)    1.000000 -0.883176
>>x             -0.883176  1.000000
>>
>>I developed this by looking at attributes(fit), then attributes(sumfit), 
>>etc. 
>>    
>>
>
>  
>




More information about the R-help mailing list