Displaying 20 results from an estimated 10000 matches similar to: "passing model objects to anova()"
2006 Oct 08
1
Simulate p-value in lme4
Dear r-helpers,
Spencer Graves and Manual Morales proposed the following methods to
simulate p-values in lme4:
************preliminary************
require(lme4)
require(MASS)
summary(glm(y ~ lbase*trt + lage + V4, family = poisson, data =
epil), cor = FALSE)
epil2 <- epil[epil$period == 1, ]
epil2["period"] <- rep(0, 59); epil2["y"] <- epil2["base"]
2011 Apr 14
1
mixed model random interaction term log likelihood ratio test
Hello,
I am using the following model
model1=lmer(PairFrequency~MatingPair+(1|DrugPair)+(1|DrugPair:MatingPair),
data=MateChoice, REML=F)
1. After reading around through the R help, I have learned that the above
code is the right way to analyze a mixed model with the MatingPair as the
fixed effect, DrugPair as the random effect and the interaction between
these two as the random effect as well.
2010 Feb 21
1
odfWeave - merged table cells, and adding information like totals and p-values
I'm hoping I'm missing some (probably fundamental basic process) which might make my life easier!
Lets assume I have a 3 column table summarizing results from a trial from three arms (Arm A, B and C).
For each arm there will be a number of pieces of information to report. The simplest example might be to compare this to the demographic comparisons often seen in clinical traisl where you
2010 Feb 09
1
Missing interaction effect in binomial GLMM with lmer
Dear all,
I was wondering if anyone could help solve a problem of a missing interaction effect!!
I carried out a 2 x 2 factorial experiment to see if eggs from 2 different locations (Origin = 1 or 2) had different hatching success under 2 different incubation schedules (Treat = 1 or 2). Six eggs were taken from 10 females (random = Female) at each location and split between the treatments,
2010 Apr 01
2
Adding regression lines to each factor on a plot when using ANCOVA
Dear R users,
i'm using a custom function to fit ancova models to a dataset. The data are
divided into 12 groups, with one dependent variable and one covariate. When
plotting the data, i'd like to add separate regression lines for each group
(so, 12 lines, each with their respective individual slopes). My 'model1'
uses the group*covariate interaction term, and so the coefficients
2002 Aug 30
4
Intercept in model formulae.
Hi,
I'm trying to create a linear model for a dataset that has a breakpoint e.g.
# dummy dataset
x <- 1:20
y <- c(1:10,seq(10.5,15,0.5))
plot(x,y)
I've modelled this using the following formula:
temp <- lm(y ~ x*(x<=10)+x*(x>10))
I want to be able to omit the intercept (i.e. force the line through
zero) from the first of these segments (x<=10) so that I'm only
2008 Jun 03
1
Model simplification using anova()
Hello all,
I've become confused by the output produced by a call to
anova(model1,model2). First a brief background. My model used to predict
final tree height is summarised here:
Df Sum Sq Mean Sq F value Pr(>F)
Treatment 2 748.35 374.17 21.3096 7.123e-06 ***
HeightInitial 1 0.31 0.31 0.0178 0.89519
2009 Jan 29
1
Inconsistency in F values from dropterm and anova
Hi,
I'm working on fitting a glm model to my data using Gamma error structure
and reciprocal link. I've been using dropterm (MASS) in the model
simplification process, but the F values from analysis of deviance tables
reported by dropterm and anova functions are different - sometimes
significantly so. However, the reported residual deviances, degrees of
freedom, etc. are not different.
2012 May 31
1
anova of lme objects (model1, model2) gives different results depending on order of models
Hello-
I understand that it's convention, when comparing two models using the
anova function anova(model1, model2), to put the more "complicated" (for
want of a better word) model as the second model. However, I'm using lme
in the nlme package and I've found that the order of the models actually
gives opposite results. I'm not sure if this is supposed to be the case
2012 May 04
2
Binomial GLM, chisq.test, or?
Hi,
I have a data set with 999 observations, for each of them I have data on
four variables:
site, colony, gender (quite a few NA values), and cohort.
This is how the data set looks like:
> str(dispersal)
'data.frame': 999 obs. of 4 variables:
$ site : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 2 2 ...
$ gender: Factor w/ 2 levels "0","1":
2012 Mar 20
2
anova.lm F test confusion
I am using anova.lm to compare 3 linear models. Model 1 has 1 variable,
model 2 has 2 variables and model 3 has 3 variables. All models are fitted
to the same data set.
anova.lm(model1,model2) gives me:
Res.Df RSS Df Sum of Sq F Pr(>F)
1 135 245.38
2 134 184.36 1 61.022 44.354 6.467e-10 ***
anova.lm(model1,model2,model3) gives
2004 Mar 29
2
Confidence Intervals for slopes
Hi,
I'm trying to get confidence intervals to slopes from a linear model
and I can't figure out how to get at them. As a cut 'n' paste example:
#################
# dummy dataset - regression data for 3 treatments, each treatment with
different (normal) variance
x <- rep(1:10, length=30)
y <- 10 - (rep(c(0.2,0.5,0.8), each=10)*x)+c(rnorm(10, sd=0.1),
rnorm(10,
2012 Nov 02
1
add1() alternative
Hi,
I'm trying to build a hierarchical logistic regression model with lme4
package, but I have a problem on selecting the variables to include in this
model.
In a simple logistic regression, using Forward selection, i use a likelihood
ratio test to check which variables i should include in the model, using the
function add1().
The problem is that this function doesn't work with the
2010 Mar 25
1
Selecting Best Model in an anova.
Hello,
I have a simple theorical question about regresion...
Let's suppose I have this:
Model 1:
Y = B0 + B1*X1 + B2*X2 + B3*X3
and
Model 2:
Y = B0 + B2*X2 + B3*X3
I.E.
Model1 = lm(Y~X1+X2+X3)
Model2 = lm(Y~X2+X3)
The Ajusted R-Square for Model1 is 0.9 and the Ajusted R-Square for Model2 is 0.99, among many other significant improvements.
And I want to do the anova test to choose the best
2012 Mar 14
1
lme code help
Hi guys,
Got a few days left and I need to model a random effect of species on the
body mass (logM) and temperature (K) slopes. This is what i've done so far
that works:
model1<-lme(logSSP~logM + K,random=~1|species,data=data1)
model2<-lme(logSSP~logM + K,random=~K|species,data=data1)
model3<-lme(logSSP~logM + K,random=~logM|species,data=data1)
The one I now want is:
2017 Jul 30
1
Add Anova statistics in each figure
Hi R Users,
I created interaction plots in ggplot2 and was trying to add output of two way ANOVA models, especially only interaction ( example treatment*control F(XX, XX) = xxx, p = xxx) into figures, but i was not able to add. Would you mind to help on how I can add information into each figure? I have attached the example data and the code that I used for this.
dat<-structure(list(Sites
2005 Oct 19
1
anova with models from glmmPQL
Hi !
I try to compare some models obtained from glmmPQL.
model1 <-
glmmPQL(y~red*yellow+I(red^2)+I(yellow^2)+densite8+I(densite8^2)+freq8_4
+I(freq8_4^2), random=~1|num, binomial);
model2 <-
glmmPQL(y~red*yellow+I(red^2)+I(yellow^2)+densite8+I(densite8^2)+freq8_4
, random=~1|num, binomial);
anova(model1, model2)
here is the answer :
Erreur dans anova.lme(model1, model2) : Objects must
2009 May 05
1
A question about using “by” in GAM model fitting of interaction between smooth terms and factor
I am a little bit confusing about the following help message on how to fit a
GAM model with interaction between factor and smooth terms from
http://rss.acs.unt.edu/Rdoc/library/mgcv/html/gam.models.html:
?Sometimes models of the form:
E(y)=b0+f(x)z
need to be estimated (where f is a smooth function, as usual.) The
appropriate formula is:
y~z+s(x,by=z)
- the by argument ensures that the smooth
2006 Aug 03
3
between-within anova: aov and lme
I have 2 questions on ANOVA with 1 between subjects factor and 2 within factors.
1. I am confused on how to do the analysis with aov because I have seen two examples
on the web with different solutions.
a) Jon Baron (http://www.psych.upenn.edu/~baron/rpsych/rpsych.html) does
6.8.5 Example 5: Stevens pp. 468 - 474 (one between, two within)
between: gp
within: drug, dose
aov(effect ~ gp * drug *
2006 Jul 29
1
uniroot
Hello,
I am struggling to find the root of a exponent
function.
"uniroot" is complaining about a values at end points
not of opposite sign?
s<- sapply(1:length(w),function(i)
+ {
+
+ +
+
+
uniroot(saeqn,lower=-5000,upper=0.01036597923,l=list(t=w[i],gp=gp))$root
+ })
Error in uniroot(saeqn, lower = -5000, upper =
0.01036597923, l = list(t = w[i], :
f() values at