similar to: forcing a zero level in contr.sum

Displaying 20 results from an estimated 5000 matches similar to: "forcing a zero level in contr.sum"

2006 Aug 17
1
Setting contrasts for polr() to get same result of SAS
Hi all, I am trying to do a ordered probit regression using polr(), replicating a result from SAS. >polr(y ~ x, dat, method='probit') suppose the model is y ~ x, where y is a factor with 3 levels and x is a factor with 5 levels, To get coefficients, SAS by default use the last level as reference, R by default use the first level (correct me if I was wrong), The result I got is a
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 
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
2010 Jul 21
1
lm: order of dropped columns
Hi all, If presented with a singular design matrix, lm drops columns to make the design matrix non-singular. What algorithm is used to select which (and how many) column(s) to drop? Particularly, given a factor, how does lm choose levels of the factor to discard? Thanks for the help. Best, Anirban [[alternative HTML version deleted]]
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').
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
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,
2012 Oct 05
1
Setting the desired reference category with contr.sum
Hi, I have 6 career types, represented as a factor in R, coded from 1 to 6. I need to use the effect coding (also known as deviation coding) which is normally done by contr.sum, e.g. contrasts(career) <- contr.sum(6) However, this results in the 6th category being the reference, that is being coded as -1: $contrasts [,1] [,2] [,3] [,4] [,5] 1 1 0 0 0 0 2 0 1 0
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 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 =
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 <-
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]]
2003 Feb 12
1
models for square tables
I've posted a sample file for estimating loglinear models for square tables (mobility models) at http://www.xs4all.nl/~jhckx/mcl/R/ Comments and suggestions are welcome. John Hendrickx
2007 Jun 21
2
Multinomial models
Hello, I am VERY new to R (one week) and I am trying to run a multinomial logit model. The model I am using is > model1 <- multinom(Y ~ X1 + X2 + , ..., Xn) if I put in > summary(model1) I get #Error in function (classes, fdef, mtable) : unable to find an inherited method for function "fitted", for signature "multinom" and if I put in > coef(model1)
2009 Aug 31
1
GLM contrasting question
I have run a glm with a final formula of : (dependent variable = parasite load, main effects are sex, month, length and weight, with sex:month and length:weight first order interactions). I am using the summary(mod) command to give me the contrasts, which I believe use the contr.treatment command. I do not have a treatment group as such as I am comparing data from a wild system so I use the
2011 Jan 03
3
Inverse Gaussian Distribution
Dear, I want to fit an inverse gaussion distribution to a data set. The predictor variables are gender, area and agecategory. For each of these variables I've defined a baseline e.g. #agecat: baseline is 3 data<-transform(data, agecat=C(factor(agecat,ordered=TRUE), contr.treatment(n=6,base=3))) The variable 'area' goes from A to F (6 areas: A,B,C,D,E,F) How can i
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
2017 Dec 20
2
offset with a factor
Knowledgeable useRs, Please, advise how to use offset with a factor. I estimate monthly effects from a much bigger data set as monthly effects seem to be stable, and other variables are estimated from a small, but recent data set as there is variation in those non-seasonal coefficients. How can I use the seasonality estimates from the big data set as an offset provided to the small data set. I
2007 Apr 02
1
controling omitted category in factor()
Hi All How can I specify which category R should omit when running a linear model with categorical predictors? I saw it omits the first category by default, but I like to have the 3rd category omitted. Thanks for your hints. Toby
2007 Nov 13
1
FW: Reference category for explanatory factors
(Oops first mistake was posting to the wrong area) I am not sure what is needed to be posted in terms of what I have done but will explain nonetheless. I am using the msm.package and trying to specify my reference category for an outcome covariate. The following command line works: ## age of respondent - using year5a: categorical preg_fyear5a.msm<-msm(outcome~ipi, subject=id, data,