search for: contrmat

Displaying 20 results from an estimated 32 matches for "contrmat".

2010 Sep 16
1
Nemenyi test as a post-hoc test to Kruskal Wallis
Dear all, I've discovered the possibility to do the Nemenyi-Damico-Wolfe-Dunn test in the library(coin); oneway_test() With the given example I am unfortunately not able to reproduce the test. What does trafo and contrMat mean? I have a dataframe with 176 elements in 7 classes. It may be a problem, that my model isn't balanced? In Class1 I happen to have 4 elements, while there are 90 in class2. Thank you for your help, Anne ___________________________________________________________ GRATIS: Spider-Man 1-3 sowie...
2003 May 14
1
Multiple comparison and lme (again, sorry)
...e I can live with "only approximations". In another thread, Thorsten Hothorn suggested for glm (slightly edited) library(multcomp) set.seed(290875) # a factor at three levels group <- factor(c(rep(1,10), rep(2, 10), rep(3,10))) # Williams contrasts contrasts(group)<-zapsmall(mginv(contrMat(table(group), type="Will"))) # a binary response z <- factor(rbinom(30, 1, 0.5)) # estimate the model gmod <- glm( z ~ group, family=binomial(link = "logit")) summary(gmod) # exclude the intercept # Should be the following, but does not work due to a confirmed # bug in th...
2005 Mar 09
1
multiple comparisons for lme using multcomp
...0.8 76 Al800 s 0.8 77 Al800 s 0.7 > attach(tab) > library(nlme) > lm1<-lme(response~treatment,random=~1|box) > library(multcomp) Loading required package: mvtnorm > # first way to do (seem uncorrect) > summary(csimtest(coef(lm1),vcov(lm1),cmatrix=contrMat(table(treatment), type="Tukey"),df=59)) Error in csimtest(coef(lm1), vcov(lm1), cmatrix = contrMat(table(treatment), : estpar not a vector > #indeed > coef(lm1) (Intercept) treatmentAl200 treatmentAl400 treatmentAl600 treatmentAl800 a 1.546679 -0.1648540 -0.4895219...
2010 Sep 14
4
Problems with "pdf" device using "plot" "glht" function on "multcomp" library.
...uot;)), Nitratos=c(72.40,100.50, 138.30, 178.33,79.01,74.16, 23.70, 15.80,16.20, 88.93,113.01,86.53)) pdf("plot1.pdf") m1<-aov(Nitratos~Descripcion-1,data=Sx) vect1<-table(Sx$Descripcion) K<-contrMat(vect1,base=4) dnk<-glht(m1,linfct=K) summary(dnk) old.par<-par(no.readonly = TRUE) par(mai=c(1,2,1.25,1),mgp=c(3,1,0)) print(plot(dnk,las=1,xlab="")) print(abline(v=0,lty=2)) par(old.par) dev.off()
2003 May 19
1
multcomp and glm
...road, high-use trail, low-use trail, and railway line I would like to determine whether wolves are more likely to cross some features than others and am using csimtest in the package multcomp to do so. x <- coef(model) var.cov <- vcov(model) df <- model$df.residual contrast.matrix <- contrMat(rep(2,length(x), type = "Tukey") post.hoc <- csimtest(estpar = x, df=df, covm = var.cov, cmatrix = contrast.matrix) summary(post.hoc) My questions are: (1) Have I entered my parameters for the posthoc analysis correctly and does it matter which categorical variable I use as my referen...
2007 Mar 20
1
Error in nlme with factors in R 2.4.1
...data) <- dimnames : length of 'dimnames' [1] not equal to array extent An ensuing call to traceback() yields: 7: array(0, c(n, n), list(levs, levs)) 6: contr.treatment(n = 0) 5: do.call(contr[[nm]], list(n = length(levs))) 4: FUN("factor(HERBICIDE)"[[1]], ...) 3: lapply(nms, contrMat, contr = contr, data = dataMix) 2: nlme.formula(SLOPE ~ c + (d - c)/(1 + exp(b * (log(DOSE) - log(e)))), fixed = list(b ~ factor(HERBICIDE) - 1, c ~ 1, d ~ 1, e ~ factor(HERBICIDE) - 1), random = d ~ 1 | CURVE, start = sv, data = PestSci) 1: nlme(SLOPE ~ c + (d - c)/(1 +...
2003 May 05
1
multcomp and lme
I suppose that multcomp in R and multicomp in S-Plus are related and it appears that it is possible to use multicomp with lme in S-Plus given the following correspondence on s-news sally.rodriguez at philips.com 12:57 p.m. 24/04/03 -0400 7 [S] LME summary and multicomp.default() Is it possible to use multicomp with lme in R and if so what is the syntax from a simple readily available
2011 Sep 22
1
How to do Multiple Comparisons for a Mixed Effects Model
...ached an impass. When I try to conduct a multiple comparison, I get an error (See below): > fm3<- lme(abovegroundbiomass.m.2~medium*amelioration*fertilizer*treatment, random=~1|block/medium/amelioration/fertilizer) > tukeytest<-glht(fm3, linfct=mcp(treatment="Tukey")) Error in contrMat(table(mf[[nm]]), type = types[pm]) : less than two groups I wonder if anyone could help me interpret this error. Many thanks. Allan Carson [[alternative HTML version deleted]]
2011 Sep 28
0
Trouble with performing post hoc analysis Tukey for lme model using ghlt
Hi, I am new to R and I am trying to perform a post hoc tukey test using the multcomp package's ghlt for a lme model. My first attempt at doing so gave me an output, HOWEVER I have tried to do this again, it keeps coming up with the error: (Error in contrMat(table(mf[[nm]]), type = types[pm]) : less than two groups) My model is looking at effect of incubation temperature (3 groups) on PHA with hen as a my random factor. Temperature treatment has been made factorial (Tempfact). my code is as follows: library(multcomp) > PHA <- lme(DiffPHA48...
2012 Jan 09
2
Unexpected results using the oneway_test in the coin package
...e(B = 9999)) ### Nemenyi-Damico-Wolfe-Dunn test (joint ranking) NDWD <- oneway_test(breeding ~ habitat, data = mydata, ytrafo = function(data) trafo(data, numeric_trafo = rank), xtrafo = function(data) trafo(data, factor_trafo = function(x) model.matrix(~x - 1) %*% t(contrMat(table(x), "Tukey"))), teststat = "max", distribution = approximate(B = 900000)) ### global p-value print(pvalue(NDWD)) ### sites-by-site p values at alpha = 0.01 (page 244) print(pvalue(NDWD, method = "single-step")) I should be detecting some non-signif...
2013 Feb 26
1
Getting the correct factor level as Dunnett control in glht()
Hello all, I would like to do a Dunnett test in glht(). However, the factor level I want to use as the control is not the first. dunn1<-glht(model3, linfct = mcp(Container = "Dunnett"), alternative = "less") The factor container has 8 levels, so it would be nice not to manually enter in all of the contrasts. I originally discovered glht() when working with a glm model
2010 Jul 21
1
post hoc test for lme using glht ?
...Variable(s) ?Wk? of class ?integer? is/are not contained as a factor in ?model?. > is.factor(Wk) [1] FALSE > Week<-factor(Wk) > is.factor(Week) [1] TRUE > model.3<-lme(fixed=Totnum~Week*Pop, random=~1|nUID) > summary(glht(model.3, linfct=mcp(Week = "Tukey"))) Error in contrMat(table(mf[[nm]]), type = types[pm]) : less than two groups Thanks, Rob -- View this message in context: http://r.789695.n4.nabble.com/post-hoc-test-for-lme-using-glht-tp2297882p2297882.html Sent from the R help mailing list archive at Nabble.com.
2010 Dec 02
5
Tukey Test, lme, error: less than two groups
...:ProvenancefHU 0.1569524 0.07756381 467 2.023526 0.0436 No the big mystery is the Tukey test. I just can't find the mistake, it keeps telling me, that there are " less than two groups" summary(glht(PAM.lme, linfct = mcp(Provenancef = "Tukey"))) Fehler in contrMat(table(mf[[nm]]), type = types[pm]) : less than two groups I guess its important to know that I made factors out of some of the data. Here is the code: PAMdata$provenance[PAMdata$provenance == "5"] = "ES" PAMdata$provenance[PAMdata$provenance == "6"] = "HU&q...
2004 Feb 20
1
nlme and multiple comparisons
This is only partly a question about R, as I am not quite sure about the underlying statistical theory either. I have fitted a non-linear mixed-effects model with nlme. In the fixed part of the model I have a factor with three levels as explanatory variable. I would like to use Tukey HSD or a similar test to test for differences between these three levels. I have two grouping factors:
2003 May 08
0
multcomp and lme (followup)
...ls for a glm based on the normal approximation. Torsten --------------------------------------------------------------------- library(multcomp) set.seed(290875) # a factor at three levels group <- factor(c(rep(1,10), rep(2, 10), rep(3,10))) # Williams contrasts contrasts(group) <- mginv(contrMat(table(group), type="Will")) # a binary response z <- factor(rbinom(30, 1, 0.5)) # estimate the model gmod <- glm( z ~ group, family=binomial(link = "logit")) # exclude the intercept summary(csimtest(coef(gmod)[2:3], vcov(gmod)[2:3,2:3], cmatrix=diag(2),...
2007 Apr 16
0
Multiple comparisons: was Re: langage R
See library(multcomp) and ?glht ?contrMat for several procedures for multiple comparisons. The Newman Keuls test is not on the list. The related Tukey method is on the list.
2008 Jul 31
0
multiple comparison
...ANOVA model amod <- aov(response ~ trt, data = cholesterol) ### set up multiple comparisons object for all-pair comparisons cht <- glht(amod, linfct = mcp(trt = "Tukey")) summary(cht, test = adjusted("Westfall")) ### use only a subset of all pairwise hypotheses K <- contrMat(table(cholesterol$trt), type="Tukey") Ksub <- rbind(K[c(1,2,5),],"D - test" = c(-1, -1, -1, 3, 0),"E - test" = c(-1, -1, -1, 0, 3)) ### reproduce results in Westfall et al. (1999, page 172) amod <- aov(response ~ trt - 1, data = cholesterol) # case 1 summary(g...
2009 Nov 05
1
Newbie question Multcomp
Hello, I'm a totally newbie to R and I'm taking a class using S+. In the class we use the multcomp command which takes a aov object and calculates confidence intervals for all pairwise differences by the Fisher least significant differences method. How can I do this in R. Thank you for taking the time with such a basic question. I've been looking on the net for a few days and I
2010 Oct 22
1
getting all contrasts from glm
I'm using the following model to do an analysis faicout <- glm(cbind(events,patnums-events) ~ as.factor(treat) + as.factor(numtrial), family = binomial ) Is this example there are 4 treatments . In the glm object I can find the contrasts of the main treats vs the first i.e. 2v1, 3v1 and 4v1 ... however I would like to get the complete set including 3v2, 4v2, and 4v3 ... along with the
2012 Jan 12
0
multcomp two-way anova with interactions within and between
...require(multcomp) require(lme4) fit1<-lmer(response~treat1*treat2+(1|id),data=d.fr) temp<-expand.grid(treat1=unique(d.fr$treat1),treat2=unique(d.fr$treat2)) X<-model.matrix(~treat1*treat2,data=temp) # X gives me a matrix with the dimensions 12 by 12. glht(fit1, linfct = X) Tukey<-contrMat(table(d.fr$treat1),'Tukey') K1<-cbind(Tukey,matrix(0,nrow=nrow(Tukey),ncol=ncol(Tukey))) rownames(K1) <- paste(levels(d.fr$treat2)[1],rownames(K1), sep = ":") K2 <- cbind(matrix(0, nrow = nrow(Tukey), ncol = ncol(Tukey)), Tukey) rownames(K2) <- paste(levels(d.fr$trea...