similar to: Parameterisation of interaction terms in lm

Displaying 20 results from an estimated 10000 matches similar to: "Parameterisation of interaction terms in lm"

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
2017 Oct 12
2
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hi, I recently ran into an inconsistency in the way model.matrix.default handles factor encoding for higher level interactions with categorical variables when the full hierarchy of effects is not present. Depending on which lower level interactions are specified, the factor encoding changes for a higher level interaction. Consider the following minimal reproducible example: -------------- >
2002 Oct 31
3
Loess with glm ?
Hello, I am wondering if there is an easy way to combine loess() with glm() to produce a locally fitted generalised regression. I have a data set of about 5,000 observations and 5 explanatory variables, with a binary outcome. One of the explanatory variables (lets call it X) is much more predictive than the others. A single glm() regression over the entire data set produces rather poor results,
2005 Aug 29
1
lme and ordering of terms
Dear R users, When fitting a lme() object (from the nlme library), is it possible to test interactions *before* main effects? As I understand, R conventionally re-orders all terms such that highest-order interactions come last - but I??d like to know if it??s possible (and sensible) to change this ordering of terms. I??ve tried the terms() command (from aov) but I don??t know if something
2009 Dec 16
4
Creating Dummy Variables in R
Hi, I am trying to create a set of dummy variables to use within a multiple linear regression and am unable to find the codes within the manuals. For example i have: Price Weight Clarity IF VVS1 VVS2 500 8 1 0 0 1000 5.2 0 0 1 864 3 0 1 0 340
2003 Feb 14
5
Translating lm.object to SQL, C, etc function
This is my first post to this list so I suppose a quick intro is in order. I've been using SPLUS 2000 and R1.6.2 for just a couple of days, and love S already. I'm reading MASS and also John Fox's book - both have been very useful. My background in stat software was mainly SPSS (which I've never much liked - thanks heavens I've found S!), and Perl is my tool of choice for
2000 Oct 26
2
Problem with lm
Hello Everybody, I have a problem with the output of lm. In fact, when I compare the R output and the Splus output, the results appears to be different : I have a dataframe with 5 factors , 16 rows and a response. First, I tried to fit this response to a linear model : lm(rep~(A+B+C+D+E),data). The results beetween SPlus and R are different. In a second time, I tried a new fit :
2019 Aug 30
3
inconsistent handling of factor, character, and logical predictors in lm()
Dear R-devel list members, I've discovered an inconsistency in how lm() and similar functions handle logical predictors as opposed to factor or character predictors. An "lm" object for a model that includes factor or character predictors includes the levels of a factor or unique values of a character predictor in the $xlevels component of the object, but not the FALSE/TRUE values
2019 Aug 31
2
inconsistent handling of factor, character, and logical predictors in lm()
Dear Abby, > On Aug 30, 2019, at 8:20 PM, Abby Spurdle <spurdle.a at gmail.com> wrote: > >> I think that it would be better to handle factors, character predictors, and logical predictors consistently. > > "logical predictors" can be regarded as categorical or continuous (i.e. 0 or 1). > And the model matrix should be the same, either way. I think that
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]]
2003 Apr 17
1
Measure of linearity between two variables?
Hello, I am looking for a measure of linearity in the relationship between two variables. Specifically, I have two variables for which the relationship is reasonably linear over a certain range of values, and then diverges from linearity at either end of the range, as one or other variable "saturates" at a maximum or minimum value. I want to identify the region of linearity, where
2006 Aug 22
1
summary(lm ... conrasts=...)
Hi Folks, I've encountered something I hadn't been consciously aware of previously, and I'm wondering what the explanation might be. In (on another list) using R to demonstrate the difference between different contrasts in 'lm' I set up an example where Y is sampled from three different normal distributions according to the levels ("A","B","C")
2007 Jun 28
2
aov and lme differ with interaction in oats example of MASS?
Dear R-Community! The example "oats" in MASS (2nd edition, 10.3, p.309) is calculated for aov and lme without interaction term and the results are the same. But I have problems to reproduce the example aov with interaction in MASS (10.2, p.301) with lme. Here the script: library(MASS) library(nlme) options(contrasts = c("contr.treatment", "contr.poly")) # aov: Y ~
2002 Aug 20
1
About lm()
Dear Mr. and Mrs. I'm very grateful for these software and this list. My question is: when a use linear multiple regression (lm()) for my data, abundance ichthyoplankton ~ salinity + temperature + month of the year(f1 is a factor: 1 for january, 2 for february, ..., 12 for december), the summary() of results is ... Coefficients: Estimate Std. Error t value Pr(>|t|)
2001 Aug 31
2
contrasts in lm
I've been playing around with contrasts in lm by specifying the contrasts argument. So, I want to specify a specific contrast to be tested Say: > y _ rnorm(100) > x _ cut(rnorm(100, mean=y, sd=0.25),c(-3,-1.5,0,1.5,3)) > reg _ lm(y ~ x, contrasts=list(x=c(1,0,0,-1))) > coef(reg)[2] x1 -1.814101 I was surprised to see that I get a different estimate for the
2013 Mar 06
8
Understanding lm-based analysis of fractional factorial experiments
All, I have just returned to R after a decade of absence, and it is good to see that R has become such a great success! I'm trying to bring Design of Experiments into some aspects of software performance evaluation, and to teach myself that, I picked up "Experiments: Planning, Analysis and Optimization" by Wu and Hamada. I try to reproduce an analysis in the book using lm, but
2017 Oct 27
2
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hello Tyler, I want to bring to your attention the following document: "What happens if you omit the main effect in a regression model with an interaction?" (https://stats.idre.ucla.edu/stata/faq/what-happens-if-you-omit-the-main-effect-in-a-regression-model-with-an-interaction). This gives a useful review of the problem. Your example is Case 2: a continuous and a categorical regressor.
2011 Oct 28
4
Contrasts with an interaction. How does one specify the dummy variables for the interaction
Forgive my resending this post. To data I have received only one response (thank you Bert Gunter), and I still do not have an answer to my question. Respectfully, John Windows XP R 2.12.1 contrast package. I am trying to understand how to create contrasts for a model that contatains an interaction. I can get contrasts to work for a model without interaction, but not after adding the
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
2001 Jun 15
1
contrasts in lm and lme
I am using RW 1.2.3. on an IBM PC 300GL. Using the data bp.dat which accompanies Helen Brown and Robin Prescott 1999 Applied Mixed Models in Medicine. Statistics in Practice. John Wiley & Sons, Inc., New York, NY, USA which is also found at www.med.ed.ac.uk/phs/mixed. The data file was opened and initialized with > dat <- read.table("bp.dat") >