similar to: Setting the desired reference category with contr.sum

Displaying 20 results from an estimated 5000 matches similar to: "Setting the desired reference category with contr.sum"

2012 Oct 27
1
contr.sum() and contrast names
Hi! I would like to suggest to make it possible, in one way or another, to get meaningful contrast names when using contr.sum(). Currently, when using contr.treatment(), one gets factor levels as contrast names; but when using contr.sum(), contrasts are merely numbered, which is not practical and can lead to mistakes (see code at the end of this message). This issue was discussed quickly in 2005
2005 Jul 13
1
Name for factor's levels with contr.sum
Good morning, I used in R contr.sum for the contrast in a lme model: > options(contrasts=c("contr.sum","contr.poly")) > Septo5.lme<-lme(Septo~Variete+DateSemi,Data4.Iso,random=~1|LieuDit) > intervals(Septo5.lme)$fixed lower est. upper (Intercept) 17.0644033 23.106110 29.147816 Variete1 9.5819873 17.335324 25.088661 Variete2 -3.3794907 6.816101 17.011692 Variete3
2009 Jan 23
1
Interpreting model matrix columns when using contr.sum
With the following example using contr.sum for both factors, > dd <- data.frame(a = gl(3,4), b = gl(4,1,12)) # balanced 2-way > model.matrix(~ a * b, dd, contrasts = list(a="contr.sum", b="contr.sum")) (Intercept) a1 a2 b1 b2 b3 a1:b1 a2:b1 a1:b2 a2:b2 a1:b3 a2:b3 1 1 1 0 1 0 0 1 0 0 0 0 0 2 1 1 0 0 1 0
2010 Sep 15
1
contr.sum, model summaries and `missing' information
Hi, I have a dataset with a response variable and multiple factors with more than two levels, which I have been fitting using lm() or glm(). In these fits, I am generally more interested in deviations from the global mean than I am in comparing to a "control" group, so I use contr.sum() as the factor contrasts. I think I'm happy to interpret the coefficients in the model summary
2010 Jul 07
6
forcing a zero level in contr.sum
I need to use contr.sum and observe that some levels are not statistically different from the overall mean of zero. What is the proper way of forcing the zero estimate? It seems the column corresponding to that level should become a column of zeros. Is there a way to achieve that without me constructing the design matrix? Thank you. Stephen Bond [[alternative HTML version deleted]]
2011 Feb 03
3
interpret significance from the contr.poly() function
Hello R-help I don’t know how to interpret significance from the contr.poly() function . From the example below : how can I tell if data has a significant Linear/quadratic/cubic trend? > contr.poly(4, c(1,2,4,8))               .L         .Q          .C [1,] -0.51287764  0.5296271 -0.45436947 [2,] -0.32637668 -0.1059254  0.79514657 [3,]  0.04662524 -0.7679594 -0.39757328 [4,]  0.79262909 
2009 Nov 08
2
reference on contr.helmert and typo on its help page.
I'm wondering which textbook discussed the various contrast matrices mentioned in the help page of 'contr.helmert'. Could somebody let me know? BTW, in R version 2.9.1, there is a typo on the help page of 'contr.helmert' ('cont.helmert' should be 'contr.helmert').
2008 May 20
1
contr.treatments query
Hi Folks, I'm a bit puzzled by the following (example): N<-factor(sample(c(1,2,3),1000,replace=TRUE)) unique(N) # [1] 3 2 1 # Levels: 1 2 3 So far so good. Now: contrasts(N)<-contr.treatment(3, base=1, contrasts=FALSE) contrasts(N) # 1 2 # 1 1 0 # 2 0 1 # 3 0 0 whereas: contr.treatment(3, base=1, contrasts=FALSE) # 1 2 3 # 1 1 0 0 # 2 0 1 0 # 3 0 0 1 contr.treatment(3, base=1,
2002 Nov 25
1
Contr.poly for n > 100 (PR#2326)
Full_Name: David Clifford Version: Version 1.5.1 (2002-06-17) OS: Red Hat 7.3 Submission from: (NULL) (128.135.149.55) For n values above 100 there appears to be a bug in contr.poly(n). The contrast matrix should have rank n-1. Running the code below gives output (ie errors) at n=98, 100 and every value greater than 102. for(n in 2:150) { K <- contr.poly(n) rnk <-
2010 Feb 23
0
Name for factor's levels with contr.sum
Hi R-useRs, after having read http://tolstoy.newcastle.edu.au/R/help/05/07/8498.html with the same topic but five years older. the solution for a contr.sum with names for factor levels for R version 2.10.1 will be to comment out the following line #colnames(cont) <- NULL in contr.sum i guess? by the way, with contrasts=FALSE colnames are set, so i don't know what the aim is to avoid
2010 Aug 29
2
glm prb (Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : )
glm(A~B+C+D+E+F,family = binomial(link = "logit"),data=tre,na.action=na.omit) Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : contrasts can be applied only to factors with 2 or more levels however, glm(A~B+C+D+E,family = binomial(link = "logit"),data=tre,na.action=na.omit) runs fine glm(A~B+C+D+F,family = binomial(link =
2013 Apr 27
1
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
i am getting the following error Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels can any on e suggest how to rectify [[alternative HTML version deleted]]
2010 Oct 15
1
creating 'all' sum contrasts
OK, my last question didn't get any replies so I am going to try and ask a different way. When I generate contrasts with contr.sum() for a 3 level categorical variable I get the 2 orthogonal contrasts: > contr.sum( c(1,2,3) ) [,1] [,2] 1 1 0 2 0 1 3 -1 -1 This provides the contrasts <1-3> and <2-3> as expected. But I also want it to create <1-2> (i.e.
2004 Aug 20
1
drop1 with contr.treatment
Dear R Core Team I've a proposal to improve drop1(). The function should change the contrast from the default ("treatment") to "sum". If you fit a model with an interaction (which ist not signifikant) and you display the main effect with drop1( , scope = .~., test = "F") If you remove the interaction, then everything's okay. There is no way to fit a
2002 Dec 01
1
generating contrast names
Dear R-devel list members, I'd like to suggest a more flexible procedure for generating contrast names. I apologise for a relatively long message -- I want my proposal to be clear. I've never liked the current approach. For example, the names generated by contr.treatment paste factor to level names with no separation between the two; contr.sum simply numbers contrasts (I recall an
2011 May 11
1
Help with contrasts
Hi, I need to build a function to generate one column for each level of a factor in the model matrix created on an arbitrary formula (instead of using the available contrasts options such as contr.treatment, contr.SAS, etc). My approach to this was first to use the built-in function for contr.treatment but changing the default value of the contrasts argument to FALSE (I named this function
2010 Apr 21
5
Bugs? when dealing with contrasts
R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with
2005 Apr 13
2
multinom and contrasts
Hi, I found that using different contrasts (e.g. contr.helmert vs. contr.treatment) will generate different fitted probabilities from multinomial logistic regression using multinom(); while the fitted probabilities from binary logistic regression seem to be the same. Why is that? and for multinomial logisitc regression, what contrast should be used? I guess it's helmert? here is an example
2007 Oct 09
2
fit.contrast and interaction terms
Dear R-users, I want to fit a linear model with Y as response variable and X a categorical variable (with 4 categories), with the aim of comparing the basal category of X (category=1) with category 4. Unfortunately, there is another categorical variable with 2 categories which interact with x and I have to include it, so my model is s "reg3: Y=x*x3". Using fit.contrast to make the
2005 Nov 24
2
type III sums of squares in R
Hi everyone, Can someone explain me how to calculate SAS type III sums of squares in R? Not that I would like to use them, I know they are problematic. I would like to know how to calculate them in order to demonstrate that strange things happen when you use them (for a course for example). I know you can use drop1(lm(), test="F") but for an lm(y~A+B+A:B), type III SSQs are only