similar to: linear model coefficients

Displaying 20 results from an estimated 10000 matches similar to: "linear model coefficients"

2003 Jul 30
2
robust regression
Hi, trying to do a robudt regression of a two-way linear model, I keep getting the following error: > lqs(obs ~ y + s -1,method="lms", contrasts=list(s=("contr.sum"))) Error: lqs failed: all the samples were singular Robust regression with M-estimators works (also regular least square fits, of course): rlm.formula(formula = obs ~ y + s - 1, method = "M",
2011 Jun 12
1
Linear model - coefficients
Dear R Users, Using lm() function with categorical variable R use contrasts. Let assume that I have one X independent variable with 3-levels. Because R estimate only 2 parameters ( e.g. a1, a2) the coef function returns only 2 estimators. Is there any function or trick to get another a3 values. I know that using contrast sum (?contr.sum) I could compute a3 = -(a1+a2). But I have many independent
2011 May 11
1
displaying derived coefficients in lm
Hello R-help, Is there a way to get R to tell you the coefficients in a lm that it wouldn't normally tell you because of identifiability constraints? For instance, if you use contr.sum() to generate contrasts for a factor, say ## y <- some data ## x <- a factor with levels 1:6 contrasts(x) <- contr.sum(levels(x)) lm.1 <- lm(y ~ x) how would one persuade summary.lm to give the
2008 Sep 26
1
Type I and Type III SS in anova
Hi all, I have been trying to calculate Type III SS in R for an unbalanced two-way anova. However, the Type III SS are lower for the first factor compared to type I but higher for the second factor (see below). I have the impression that Type III are always lower than Type I - is that right? And a clarification about how to fit Type III SS. Fitting model<-aov(y~a*b) in the base package and
2011 May 21
2
unbalanced anova with subsampling (Type III SS)
Hello R-users, I am trying to obtain Type III SS for an ANOVA with subsampling. My design is slightly unbalanced with either 3 or 4 subsamples per replicate. The basic aov model would be: fit <- aov(y~x+Error(subsample)) But this gives Type I SS and not Type III. But, using the drop() option: drop1(fit, test="F") I get an error message: "Error in
2006 Jan 11
1
hypothesis testing for rank-deficient linear models
Take the following example: a <- rnorm(100) b <- trunc(3*runif(100)) g <- factor(trunc(4*runif(100)),labels=c('A','B','C','D')) y <- rnorm(100) + a + (b+1) * (unclass(g)+2) m <- lm(y~a+b*g) summary(m) Here b is discrete but not treated as a factor. I am interested in computing the effect of b within groups defined by the
2008 Nov 10
1
question about contrast in R for multi-factor linear regression models?
Hi all, I am using "lm" to fit some anova factor models with interactions. The default setting for my unordered factors is "treatment". I understand the resultant "lm" coefficients for one factors, but when it comes to the interaction term, I got confused. > options()$contrasts unordered ordered "contr.treatment"
2010 Sep 29
1
Understanding linear contrasts in Anova using R
#I am trying to understand how R fits models for contrasts in a #simple one-way anova. This is an example, I am not stupid enough to want #to simultaneously apply all of these contrasts to real data. With a few #exceptions, the tests that I would compute by hand (or by other software) #will give the same t or F statistics. It is the contrast estimates that R produces #that I can't seem to
2004 Mar 23
2
Coefficients and standard errors in lme
Hello, I have been searching for ways to obtain these for combinations of fixed factors and levels other than the 'baseline' group (contrasts coded all 0's) from a mixed-effects model in lme. I've modelled the continuous variable y as a function of a continuous covariate x, and fixed factors A, B, and C. The fixed factors have two levels each and I'd like to know whether
2012 Jun 12
1
Two-way linear model with interaction but without one main effect
Hi, I know that the type of model described in the subject line violates the principle of marginality and it is rare in practice, but there may be some circumstances where it has sense. Let's take this imaginary example (not homework, just a silly made-up case for illustrating the rare situation): I'm measuring the energy absorption of sports footwear in jumping. I have three models (S1,
2004 Mar 03
1
Confusion about coxph and Helmert contrasts
Hi, perhaps this is a stupid question, but i need some help about Helmert contrasts in the Cox model. I have a survival data frame with an unordered factor `group' with levels 0 ... 5. Calculating the Cox model with Helmert contrasts, i expected that the first coefficient would be the same as if i had used treatment contrasts, but this is not true. I this a error in reasoning, or is it
2009 Dec 18
1
linear contrasts for trends in an anova
Hi everybody, I'm trying to construct contrasts for an ANOVA to determine if there is a significant trend in the means of my groups. In the following example, based on the type of 2x3 ANOVA I'm trying to perform, does the linear polynomial contrast generated by contr.poly allow me to test for a linear trend across groups? doi=data.frame( Group=c( rep(1, 5), rep(2, 5), rep(3, 5),
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
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 Jun 23
4
contrats hardcoded in aov()?
On 6/23/05, RenE J.V. Bertin <rjvbertin at gmail.com> wrote: > Hello, > > I was just having a look at the aov function source code, and see that when the model used does not have an Error term, Helmert contrasts are imposed: > > if (is.null(indError)) { > ... > } > else { > opcons <- options("contrasts") >
2009 Sep 17
2
What does model.matrix() return?
Hi, I don't understand what the meaning of the following lines returned by model.matrix(). Can somebody help me understand it? What can they be used for? attr(,"assign") [1] 0 1 2 2 attr(,"contrasts") attr(,"contrasts")$A [1] "contr.treatment" attr(,"contrasts")$B [1] "contr.treatment" Regards, Peng > a=2 > b=3 > n=4
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
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
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
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