[R] error problem with glht
Peter Furey
furey at cires.colorado.edu
Thu Jul 12 19:06:41 CEST 2007
Can anyone help me?
I'm having problems with the following code where I want to test the null
hypothesis that regression slopes are the same among regressions. Here's the
code I've written with comments that include the final error I get. ...
initial.dir <- getwd()
library(systemfit)
library(multcomp)
basdata <- read.table("data_into7_test.txt", header=TRUE,sep="")
#show basdata
basdata
#output from above looks like this ...
# basin Order lnLcl lnArea
#1 SFK 6 3.46322000 5.19766000
#2 SFK 6 3.51767000 5.11809000
#3 SFK 6 3.79962000 5.79118000
#4 SFK 6 2.90242000 4.09768000
#5 SFK 4 1.92408000 2.31617000
# ....
#21 NFK 6 3.88342000 5.50927000
#22 NFK 6 3.84522000 5.13474000
#23 NFK 6 3.49130000 5.28586000
# ....
#linear model fit and analysis of variance
fit_area_1 <- lm(lnArea~Order*basin,data=basdata)
anova_area_1 <- anova(fit_area_1)
#get coefficients, covariance matrix, terms
coef(fit_area_1)
vcov(fit_area_1)
terms(fit_area_1)
#perform multiple comparisons to test null hypothesis that
#linear model fits are the same among basins
fit1_mc <- glht(anova_area_1,linfct=mcp(basin="Tukey"))
#the line above gives ...
#Error in terms.default(object) : no terms component
#Error in factor_contrasts(model) : no model.matrix method for model found!
I appreciate any help offered.
Cheers, Pete
------
Peter Furey
Research Scientist
Northwest Research Associates / CORA
3380 Mitchell Lane
Boulder, CO 80301
Also affiliated with:
Cooperative Institute for Research in Environmental Sciences (CIRES)
University of Colorado, Boulder
More information about the R-help
mailing list