[R] matrix with standard errors of lm model
Bert Gunter
gunter.berton at gene.com
Thu Aug 8 23:11:22 CEST 2013
Not quite, David. ... (see inline)
On Thu, Aug 8, 2013 at 1:56 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Aug 8, 2013, at 10:54 AM, Bert Gunter wrote:
>
>> Perhaps
>>
>> ?vcov
>>
>> is what you are looking for.
>>
>> -- Bert
>>
>> On Thu, Aug 8, 2013 at 10:37 AM, iza.ch1 <iza.ch1 at op.pl> wrote:
>>> Hi
>>>
>>> Can someone give me a hint on how to create a matrix with standard errors from lm model? I have already managed to get the matrix with coefficients:
>>>
>>> coef<-as.data.frame(sapply(seq_len(ncol(es.w)),function( i) {x1<- summary(lm(es.w[,i]~es.median[,i]));x1$coef[,1]}))
>>>
>>> but I can't get the one like this for standard errors. I do regression for each column.
>>>
>
> It's a bit of a "feature" that coef(summary(lm(...))) returns a 4 column matrix of coefficients, standard errors, t-ratios and p-values while coef(lm(...)) just returns the estimated coefficients.
>
> ?lm
> ?summary.lm
>
> The third column of the coef(summary(....)) result should be == diag(vcov(lm(...)).
No, it's == sqrt(diag(vcov(lm(...))
-- Bert
>
> --
> David Winsemius
> Alameda, CA, USA
>
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
More information about the R-help
mailing list