Displaying 20 results from an estimated 7000 matches similar to: "setting options when using eval"
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")
>
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
2006 May 11
2
greco-latin square
Hi,
I am analyzing a repeated-measures Greco-Latin Square with the aov command.
I am using aov to calculate the MSs and then picking by hand the appropriate
neumerator and denominator terms for the F tests.
The data are the following:
responseFinger
mapping.code Subject.n index middle ring
little
----------------------------------------------------------------------------
1 1
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
2010 Sep 23
2
Contraste polinomial con dos factores con niveles no equidistantes
Hola compañeros de la lista, qué tal.
Los molesto con la siguiente duda: Tengo un experimento con dos
factores A y B, cada uno de los cuales tiene los siguientes niveles (que
son concentraciones de dos hormonas vegetales aplicadas a plantas):
niveles del factor A: 0, 0.2, 0.5, 1
niveles del factor B: 0, 0.1, 0.2, 0.5, 1
y mi variable de respuesta es continua, todo dentro del set de datos
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 Feb 23
1
model.matrix for a factor effect with no intercept
I was surprised by this (in R 2.0.1):
> a <- ordered(-1:1)
> a
[1] -1 0 1
Levels: -1 < 0 < 1
> model.matrix(~ a)
(Intercept) a.L a.Q
1 1 -7.071068e-01 0.4082483
2 1 -9.073800e-17 -0.8164966
3 1 7.071068e-01 0.4082483
attr(,"assign")
[1] 0 1 1
attr(,"contrasts")
attr(,"contrasts")$a
[1]
2010 Jun 11
0
passing constrasts=FALSE to contrast functions -- why does this exist?
Hello,
I've noticed that all contrast functions, like contr.treatment,
contr.poly, etc., take a logical argument called 'contrasts'. The
default is TRUE, in which case they do their normal thing of returning
a n x n-1 matrix whose columns are linearly-independent of the
intercept.
If contrasts=FALSE, they instead return an n x n matrix with full rank
(usually the identity matrix,
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
2007 Feb 14
1
se.contrast confusion
Hello,
I've got what I'd expect to be a pretty simple issue: I fit an aov object
using multiple error strata, and would like some significance tests for the
contrasts I specified.
In this contrived example, I model some test score as the interaction of a
subject's gender and two emotion variables (angry, happy, neutral), measured
at entry to the experiment (entry) and later
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
2003 Aug 14
1
gnls - Step halving....
Hi all,
I'm working with a dataset from 10 treatments, each
treatment with 30 subjects, each subject measured 5
times. The plot of the dataset suggests that a
3-parameter logistic could be a reasonable function to
describe the data. When I try to fit the model using
gnls I got the message 'Step halving factor reduced
below minimum in NLS step'. I´m using as the initial
values of the
2005 Apr 23
2
ANOVA with both discreet and continuous variable
Hi all,
I have dataset with 2 independent variable, one (x1)
is continuous, the other (x2) is a categorical
variable with 2 levels. The dependent variable (y) is
continuous. When I run linear regression y~x1*x2, I
found that the p value for the continuous independent
variable x1 changes when different contrasts was used
(helmert vs. treatment), while the p values for the
categorical x2 and
2012 Oct 07
1
Why do I get different results for type III anova using the drop1 or Anova command?
Dear experts,
I just noticed that I get different results conducting type III anova
using drop1 or the Anova command from the car package. I suppose I made
a mistake and hope you can offer me some help. I have no idea where I
got wrong and would be very grateful for explaination as R is new
terrain for me.
If I run the commands in line, they produce the same results. But if I
run them in
2006 Sep 23
1
contrasts in aov
useRs,
A no doubt simple question, but I am baffled. Indeed, I think I
once knew the answer, but can't recover it. The default contrasts
for aov (and lm, and...) are contr.treatment and contr.poly for
unordered and ordered factors, respectively. But, how does one
invoke the latter? That is, in a data.frame, how does one indicate
that a factor is an *ordered* factor such that
2006 Jul 28
0
tests performed by anova
Dear R-helpers,
In the case of two categorical factors, say a and b, once I have
fixed the constrasts, the model matrix is set according to these
contrasts with "lm", and the t-tests for the significance of the
parameters provided by "summary" indeed concern the comparison of the
model with each submodel obtained by removing the corresponding
column of the model matrix.
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
1999 May 05
1
Ordered factors , was: surrogate poisson models
For ordered factor the natural contrast coding would be to parametrize by
the succsessive differences between levels, which does not assume equal
spacing
of factor levels as does the polynomial contrasts (implicitly at least).
This requires the contr.cum, which could be:
contr.cum <- function (n, contrasts = TRUE)
{
if (is.numeric(n) && length(n) == 1)
levs <- 1:n
2007 May 17
1
model.matrix bug? Nested factor yields singular design matrix.
Hi all,
I believe this is a bug in the model.matrix function.
I'd like a second opinion before filing a bug report.
If I have a nested covariate B with multiple values for
just one level of A, I can not get a non-singular design
matrix out of model.matrix
> df <- data.frame(A = factor(c("a", "a", "x", "x"), levels = c("x",