Displaying 20 results from an estimated 10000 matches similar to: "Translating lm.object to SQL, C, etc function"
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
1999 Oct 22
1
factors in glm
Is there any logical reason why glm prints out the labels of factor
levels after variable names when baseline contrasts (contr.treatment)
are used but the codes for the levels when mean contrasts (contr.sum)
are used? Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info",
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
2009 Apr 26
2
eager to learn how to use "sapply", "lapply", ...
After a year my R programming style is still very "C like".
I am still writing a lot of "for loops" and finding it difficult to recognize where, in place of loops, I could just do the
same with one line of code, using "sapply", "lapply", or the like.
On-line examples for such high level function do not help me.
Even if, sooner or later, I am getting my R
2008 Sep 30
2
weird behavior of drop1() for polr models (MASS)
I would like to do a SS type III analysis on a proportional odds logistic
regression model. I use drop1(), but dropterm() shows the same behaviour. It
works as expected for regular main effects models, however when the model
includes an interaction effect it seems to have problems with matching the
parameters to the predictor terms. An example:
library("MASS");
options(contrasts =
2008 Oct 15
1
Parameter estimates from an ANCOVA
Hi all,
This is probably going to come off as unnecessary (and show my ignorance)
but I am trying to understand the parameter estimates I am getting from R
when doing an ANCOVA. Basically, I am accustomed to the estimate for the
categorical variable being equivalent to the respective cell means minus the
grand mean. I know is the case in JMP - all other estimates from these data
match the
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
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
2008 Sep 27
1
retrieving weights from a polr object
Dear list members,
The polr() function in the MASS package takes an optional weights argument
for case weights. Is there any way to retrieve the case weights from the
fitted "polr" object? Examining both the object and the code, I don't see
how this can be done, but perhaps I've missed something.
Any help would be appreciated.
John
------------------------------
John Fox,
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').
2002 Oct 09
3
proc mixed vs. lme
Dear All,
Comparing linear mixed effect models in SAS and R, I found the following
discrepancy:
SAS R
random statement random subj(program); random = ~ 1 |
Subj
-2*loglik 1420.8 1439.363
random effects
variance(Intercept) 9.6033 9.604662
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
2008 Dec 18
2
Render a view from console
Hello!
In my application I''m trying to render a view from a class in /lib
folder. I have found that it''s very similar to render a view from
console. So, I have tried different methods:
>> string = ActionView::Base.new.render( :inline => ''works'', :layout => false )
=> "works"
>> string = ActionView::Base.new.render( :template =>
2011 Mar 01
1
How to understand output from R's polr function (ordered logistic regression)?
I am new to R, ordered logistic regression, and polr.
The "Examples" section at the bottom of the help page for
polr<http://stat.ethz.ch/R-manual/R-patched/library/MASS/html/polr.html>(that
fits a logistic or probit regression model to an ordered factor
response) shows
options(contrasts = c("contr.treatment", "contr.poly"))
house.plr <- polr(Sat ~ Infl +
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
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
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
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
2002 Nov 07
4
Preferable contrasts?
Dear all,
I'm working with Cox-regression, because data could be censored.
But in this particular case not.
Now I have a simple example: PRO and PRE are (0,1) coded.
The response is not normal distributed.
We are interested in a model which could describe interaction.
But my results are depending strongly in the choose of the contrast option.
It is clear that there is some dependence in
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