similar to: glm prb (Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : )

Displaying 20 results from an estimated 8000 matches similar to: "glm prb (Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : )"

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]]
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 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
2004 Dec 02
1
treatment contrasts and summary.lm
Dear list members, I have a 2-factor ANOVA where the summary.lm output looks like this (using treatment contrasts): Value Std. Error t value Pr(>|t|) (Intercept) 0.0389 0.0220 1.7695 0.0817 as.factor(Block)1 0.0156 0.0066 2.3597 0.0215 as.factor(Block)2 -0.0018 0.0037 -0.4857 0.6289 as.factor(Block)3 -0.0007 0.0026 -0.2812 0.7795
2005 Feb 20
1
Treatment-Contrast Interactions
Hello all, (Apologies in advance if my terminology is incorrect, I'm relatively new to R and statistics). I have data from a factorial design with two treatments (CRF-23), and I'm trying to compute treatment-contrast interactions through analysis of variance. I can't figure out how to do contrasts properly, despite reading the help for "C" and "contrasts"
2005 Jun 30
2
Finding out collinearity in regression
Hi, I am trying to find out a collinearity in explanatory variables with alias(). I creat a dataframe: dat <- ds[,sapply(ds,nlevels)>=2] dat$Y <- Response Explanatory variables are factor and response is continuous random variable. When I run a regression, I have the following error: fit <- aov( Y ~ . , data = dat) Error in "contrasts<-"(`*tmp*`, value =
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
2012 Oct 23
3
Error in contrasts message when using logistic regression code.
I have a rather large data set (about 30 predictor variables) I need to preform a logistic regression on this data. My response variable is binary. My code looks like this: mylogit <- glm(Enrolled ~ A + B + C + ... + EE, data = data, family = binomial(link="logit")) with A,B,C, ... as my predictor variables. Some categorical, some continuous, some binary. I run the code and get
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
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 
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]]
2010 Mar 31
2
interpretation of p values for highly correlated logistic analysis
Dear list, I want to perform a logistic regression analysis with multiple categorical predictors (i.e., a logit) on some data where there is a very definite relationship between one predicator and the response/independent variable. The problem I have is that in such a case the p value goes very high (while I as a naive newbie would expect it to crash towards 0). I'll illustrate my problem
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
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
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
2008 Aug 26
2
options("contrasts")
Code: > options("contrasts") $contrasts factor ordered "contr.treatment" "contr.poly" I want to change the first entry ONLY, without retyping "contr.poly". How do I do it? I have tried various possibilities and cannot get anything to work. I found out that the response to options("contrasts") has class
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 Oct 11
2
R vs SPSS contrasts
Hi Folks, I'm comparing some output from R with output from SPSS. The coefficients of the independent variables (which are all factors, each at 2 levels) are identical. However, R's Intercept (using default contr.treatment) differs from SPSS's 'constant'. It seems that the contrasts were set in SPSS using /CONTRAST (varname)=Simple(1) I can get R's Intercept to match
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
2010 Dec 03
3
Checking for orthogonal contrasts
A common point made in discussion of contrasts, type I, II, III SS etc is that for sensible comparisons one should use contrasts that are 'orthogonal in the row-basis of the model matrix' (to quote from http://finzi.psych.upenn.edu/R/Rhelp02/archive/111550.html) Question: How would one check, in R, that this is so for a particular fitted linear model object? Steve Ellison