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: [EMAIL PROTECTED] 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 > > ______________________________________________ > [email protected] 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. > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.
