Displaying 20 results from an estimated 3000 matches similar to: "Specifying xlevels in effects library"
2011 Mar 30
1
Using xlevels
I'm working on predict.survreg and am confused about xlevels.
The model.frame method has the argument, but none of the standard
methods (model.frame.lm, model.frame.glm) appear to make use of it.
The documentation for model.matrix states:
xlev: to be used as argument of model.frame if data has no "terms"
attribute.
But the terms attribute has no xlevels information in it, so I
2013 Jan 12
2
Interpreting coefficients in linear models with interaction terms
Hi,
I am trying to interpret the coefficients in the model: RateOfMotorPlay ~
TestNumber + Sex + TestNumber * Sex where there are thee different tests and
Sex is (obviously) binary. My results are: Residuals:
Min 1Q Median 3Q Max
-86.90 -26.28 -7.68 22.52 123.74
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.430 6.248
2008 Aug 16
1
ANCOVA: Next steps??
Having spent the last few weeks trying to decipher R, I feel I may finally be getting somewhere, but i'M still in need of some advice and all my tutors seem to be on holiday!
Basically a bit of background, I have data collected on a population of Lizards which includes age,sex, and body condition. I collected data myself this year and I have data previously collected from 1999, 2002 and
2004 Jun 09
5
Getting Pr from Summary(lm)
Hello,
I am trying to get the P values from the output of a summary for lm.
lm <- lm(y ~ age + sex)
s <- summary(lm)
I thought that I might be able to get them using a combination of scan,
grep and sub.
But I got stuck on the first step - being able to process "s" as a text
string.
I could perhaps write it to file than scan it back but there is probably
an easier
way to do
2017 Jun 15
2
duplicated factor labels.
Dear R devel
I've been wondering about this for a while. I am sorry to ask for your
time, but can one of you help me understand this?
This concerns duplicated labels, not levels, in the factor function.
I think it is hard to understand that factor() fails, but levels()
after does not
> x <- 1:6
> xlevels <- 1:6
> xlabels <- c(1, NA, NA, 4, 4, 4)
> y <- factor(x,
2018 Mar 08
0
Names of variables needed in newdata for predict.glm
Hi,
Some try:
> names(mi$xlevels)
[1] "f"
> all.vars(mi$formula)
[1] "D" "x" "f" "Y"
> names(mx$xlevels)
[1] "f"
> all.vars(mx$formula)
[1] "D" "x" "f"
When offset is indicated out of the formula, it does not work...
Marc
Le 07/03/2018 ? 06:20, Bendix Carstensen a ?crit?:
> I would like
2011 Jun 14
1
Expand DF with all levels of a variable
Dear list,
I would like to expand a DF with all the missing levels of a variable.
a <- c(2,2,3,4,5,6,7,8,9)
a.cut <- cut(a, breaks=c(0,2,6,9,12), right=FALSE )
(x <- data.frame(a, a.cut))
# In 'x' the level "[0,2)" is "missing".
AddMissingLevel <- function(xdf) {
xfac <- factor( c("[0,2)", "[2,6)", "[6,9)",
2010 Oct 04
2
Plot for Binomial GLM
Hi i would like to use some graphs or tables to explore the data and make
some sensible guesses of what to expect to see in a glm model to assess if
toxin concentration and sex have a relationship with the kill rate of rats.
But i cant seem to work it out as i have two predictor
variables~help?Thanks.:)
Here's my data.
>
2012 Feb 25
1
Unexpected behavior in factor level ordering
Hello, Everybody:
This may not be a "bug", but for me it is an unexpected outcome. A
factor variable's levels
do not retain their ordering after the levels function is used. I
supply an example in which
a factor with values "BC" "AD" (in that order) is unintentionally
re-alphabetized by the levels
function.
To me, this is very bad behavior. Would you agree?
#
2010 May 04
1
help overlay scatterplot to effects plot
I have a process where I am creating a effects plot similar to the cowles effect example. I would like to add the point estimates to the effects plot, can someone show me the correct syntax. I have included the "R" effects example, so you can show me the correct syntax. Thanks
mod.cowles <- glm(volunteer ~ sex + neuroticism*extraversion,
data=Cowles, family=binomial)
2003 Mar 15
1
formula, how to express for transforming the whole model.matrix, data=Orthodont
Hi, R or S+ users,
I want to make a simple transformation for the model,
but for the whole design matrix.
The model is distance ~ age * Sex, where Sex is a
factor. So the design matrix may look like the
following:
(Intercept) age SexFemale age:SexFemale
1 1 8 0 0
2 1 10 0 0
3 1 12 0 0
4
2010 Nov 16
1
glmer, Error: Downdated X'X is not positive definite,49
Dear list,
I am new to this list and I am new to the world of R. Additionally I am not
very firm in statistics either but have to deal. So here is my problem:
I have a dataset (which I attach at the end of the post) with a binomial
response variable (alive or not) and three fixed factors
(trapping,treat,sex). I do have repeated measures and would like to include
one (enclosure) random factor.
I
2008 Feb 12
1
Finding LD50 from an interaction Generalised Linear model
Hi,
I have recently been attempting to find the LD50 from two predicted fits
(For male and females) in a Generalised linear model which models the effect
of both sex + logdose (and sex*logdose interaction) on proportion survival
(formula = y ~ ldose * sex, family = "binomial", data = dat (y is the
survival data)). I can obtain the LD50 for females using the dose.p()
command in the MASS
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
2018 Mar 31
1
Names of variables needed in newdata for predict.glm
all.vars works fine, EXCEPT, it give a bit too much.
I only want the regression variables, but in the following example I also get "k" the variable holding the chosen knots. Any machinery to find only "real" regression variables?
cheers, Bendix
library( splines )
y <- rnorm(100)
x <- rnorm(100)
k <- -1:1
ml <- lm( y ~ bs(x,knots=k) )
mg <- glm( y ~
2008 Sep 03
1
test if all predictors in a glm object are factors
I'm trying to develop some graphic methods for glm objects, but they
only apply for models
where all predictors are discrete factors. How can I test for this in a
function, given the
glm model object?
That is, I want something that will serve as an equivalent of
is.discrete.glm() in the following
context:
myplot.glm <-
function(model, ...) {
if (!inherits(model,"glm"))
2018 Mar 07
3
Names of variables needed in newdata for predict.glm
I would like to extract the names, modes [numeric/factor] and levels
of variables needed in a data frame supplied as newdata= argument to
predict.glm()
Here is a small example illustrating my troubles; what I want from
(both of) the glm objects is the vector c("x","f","Y") and an
indication that f is a factor:
library( splines )
dd <- data.frame( D =
2004 May 27
1
Getting the same values of adjusted mean and standard errors as SAS
Hello,
I am trying to get the same values for the adjusted means and standard
errors using R that are given in SAS for the
following data. The model is Measurement ~ Age + Gender + Group. I can
get the adusted means at the mean age
by using predict. I do not know how to get the appropriate standard
errors at the adjusted means for Gender
using values from predict. So I attempted to get them
2007 Jun 18
1
how to obtain the OR and 95%CI with 1 SD change of a continue variable
Dear all,
How to obtain the odds ratio (OR) and 95% confidence interval (CI) with
1 standard deviation (SD) change of a continuous variable in logistic
regression?
for example, to investigate the risk of obesity for stroke. I choose the
happening of stroke (positive) as the dependent variable, and waist
circumference as an independent variable. Then I wanna to obtain the OR
and 95% CI with
2011 Feb 08
3
intervals {nlme} lower CI greater than upper CI !!!????
Hi folks...
check this out..
> GLU<-lme(gluc~rt*cd4+sex+age+rf+nadir+pharmac+factor(hcv)+factor(hbs)+
+ haartd+hivdur+factor(arv),
+ random= ~rt|id, na.action=na.omit)
> intervals(GLU)$fixed
lower est. upper
(Intercept) 67.3467070345 7.362307e+01 7.989944e+01
rt *0.0148050160* 6.249304e-02 1.101811e-01
cd4