[R] linear coefficient combination stderr?
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Feb 14 12:52:39 CET 2007
vcov can simplify it slightly:
se <- sqrt( t(a) %*% vcov(m) %*% a )
( a %*% beta ) / se
On 2/14/07, Abhijit Dasgupta <Abhijit.Dasgupta at mail.jci.tju.edu> wrote:
> look at the function "estimable" in the package gmodels. This does the
> t.stat that you mention below.
>
> Otherwise, if you wanted to do this by hand, :
>
> beta = m$coef
> V = summary(m)$cov.unscaled
> sigma = summary(m)$sigma
>
> covBeta = V*sigma^2
>
> Now if your contrast is a%*%beta, then its se is
> sqrt(t(a)%*%covBeta%*%a) and so the t.stat below is
>
> t.stat = (a%*%beta)/sqrt(t(a)%*%covBeta%*%a)
> or, in your particular case
>
> t.stat = (beta[2]+beta[3])/sqrt(t(c(0,1,1))%*%covBeta%*%c(0,1,1))
>
> Abhijit
>
> Søren Højsgaard wrote:
> > Try the esticon function in the doBy package.
> > Regards
> > Søren
> >
> > ________________________________
> >
> > Fra: r-help-bounces at stat.math.ethz.ch på vegne af ivo welch
> > Sendt: on 14-02-2007 04:21
> > Til: r-help
> > Emne: [R] linear coefficient combination stderr?
> >
> >
> >
> > dear r-experts---I have scrounged around in google (searching r-help)
> > for the really obvious, but failed. could someone please point me to
> > whatever function computes the standard error of a linear combination
> > of the coefficients?
> >
> > m=lm( y ~ x1 + x2 + x3 );
> > t.stat= (coef(m)[2]+coef(m)[3])) / mystery.function( m, x2 + x3 );
> >
> > obviously, this does not work, but hopefully explains my intent.
> > quick pointer appreciated.
> >
> > regards,
> >
> > /iaw
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
More information about the R-help
mailing list