[R] using contrasts on matrix regressions (using gmodels, perhaps)
Søren Højsgaard
Soren.Hojsgaard at agrsci.dk
Thu Jul 26 02:22:29 CEST 2007
The doBy package has an esticon function which allows you to do that.
Regards
Søren
________________________________
Fra: r-help-bounces at stat.math.ethz.ch på vegne af Ranjan Maitra
Sendt: to 26-07-2007 01:30
Til: R-help
Emne: [R] using contrasts on matrix regressions (using gmodels, perhaps)
Hi,
I want to test for a contrast from a regression where I am regressing the columns of a matrix. In short, the following.
X <- matrix(rnorm(50),10,5)
Y <- matrix(rnorm(50),10,5)
lm(Y~X)
Call:
lm(formula = Y ~ X)
Coefficients:
[,1] [,2] [,3] [,4] [,5]
(Intercept) 0.3350 -0.1989 -0.1932 0.7528 0.0727
X1 0.2007 -0.8505 0.0520 0.1501 0.3248
X2 0.3212 0.7008 -0.0963 -0.2584 0.6711
X3 0.3781 -0.7321 0.1907 -0.1721 0.3073
X4 -0.1778 0.2822 -0.0644 -0.2649 -0.4140
X5 -0.1079 -0.0475 0.6047 -0.8369 -0.5928
I want to test for c'b = 0 where c is (lets say) the contrast (0, 0, 1, 0, -1). Is it possible to do so, in one shot, using gmodels or something else?
Many thanks and best wishes,
Ranjan
______________________________________________
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