search for: fm2

Displaying 20 results from an estimated 126 matches for "fm2".

Did you mean: f2
2006 Oct 18
1
lmer- why do AIC, BIC, loglik change?
...As an example, when I run the code below the model summaries (AIC, BIC, loglik) differ between the summary() and anova() commands. Can anyone clear up what's wrong? Thank you! Darren Ward library(lme4) data(sleepstudy) fm1<-lmer(Reaction ~ Days + (1|Subject), sleepstudy) summary(fm1) fm2<-lmer(Reaction ~ Days + (Days|Subject), sleepstudy) summary(fm2) anova(fm1, fm2) Sample output: > summary(fm1) Linear mixed-effects model fit by REML Formula: Reaction ~ Days + (1 | Subject) Data: sleepstudy AIC BIC logLik MLdeviance REMLdeviance 1792 1802 -893.2 1794...
2009 Sep 06
3
linear mixed model question
...ctly. Then I decided to complicate the model a little bit by fitting 'Worker' within 'Machine', which was saying variation among workers was nested within each machine. The model could be fitted by 'lme', but when I tried to get confidence intervals by 'intervals(fm2)' it gave me an error: Error in intervals.lme(fm2) : Cannot get confidence intervals on var-cov components: Non-positive definite approximate variance-covariance I am wondering if this is because it is impossible to fit a model like 'fm2' or there is some other reasons? Thanks...
2002 Dec 15
2
Interpretation of hypothesis tests for mixed models
...rt is a two-level factor (two treatments) for which there are several (n) responses y from each treatment and subject combination. If one suspects a subject by treatment interaction, either of the following models seem natural > fm1 <- lme(y ~ Trt, random = list(Subj = pdDiag(~ Trt))) > fm2 <- lme(y ~ trt, random = ~ 1 | Subj/Trt) These models seem to correspond to the same situation. Both have two variance components (subject and treatment within subject). However, they result in different denominator degrees of freedom (denDF) of the F-statistic for a (fixed-effect) test for tre...
2005 Jun 08
0
bug in predict.lme?
...cannot extract the formula from the variable. THe code below demonstrates this. Is this a known or expected behavour of predict.lme or is this a bug? kind regards, Arne (R-2.1.0) > library(nlme) ... > mod <- distance ~ age + Sex # example from ?lme > mod distance ~ age + Sex > fm2 <- lme(mod, data = Orthodont, random = ~ 1) > anova(fm2) numDF denDF F-value p-value (Intercept) 1 80 4123.156 <.0001 age 1 80 114.838 <.0001 Sex 1 25 9.292 0.0054 > fm2 Linear mixed-effects model fit by REML Data: Orthodont...
2008 May 27
3
How to test significant differences for non-linear relationships for two locations
Hi List, I have to compare a relationship between y and x for two locations. I found logistic regression fits both datasets well, but I am not sure how to test if relationships for both sites are significantly different. I searched the r site, however no answers exactly match the question. I used Tukey's HSD to compare two means, but the relationship in my study was not simply linear. So I
2012 Mar 20
1
Remove quotes from a string to use in a variable call
Hi, I have a string that I want to use in a variable call. How can I remove the quotes and/or the string properties of the string to use it in a variable call? Here's an example: library(lme) fm2 <- lme(distance ~ age, data = Orthodont, random = ~ 1) summary(fm2) I want to update the above regression to include new predictors according to what is in a string: predictors <- "age + Sex" update(fm2,fixed=distance ~ age + Sex) #this works update(fm2,fixed=distance ~ noquote(pr...
2005 Sep 25
2
summary nls output
Dear R user: I bulid a package, and in the package I use the function "nls" to solve some questions. If I have two sets of data, and I want to summary these two data's nls output, I write the command in the package source code like: { .......... summary(fm1) summary(fm2) } then i compiler the package and use "Install package(s) from local zip files" to install my package. But when I run the package, it just show the summary(fm2), the part of summary(fm1) miss, why is it so? Any suggestions would be most helpful! Thanks!!
2012 Jan 17
1
MuMIn package, problem using model selection table from manually created list of models
...work, especially with bivariate smooths, I'd be most grateful. Cheers and Thanks in Advance Mike require(MuMIn) data(Cement) # option 1, create model.selection object using dredge fm0 <- lm(y ~ ., data = Cement) print(dd <- dredge(fm0)) fm1 <- lm(formula = y ~ X1 + X2, data = Cement) fm2 <- lm(formula = y ~ X1 + X2 + X4, data = Cement) fm3 <- lm(formula = y ~ X1 + X2 + X3, data = Cement) fm4 <- lm(formula = y ~ X1 + X4, data = Cement) fm5 <- lm(formula = y ~ X1 + X3 + X4, data = Cement) # ranked with AICc by default # obviously this works model.avg(get.models(dd, delta...
2006 Mar 29
1
Lmer BLUPS: was(lmer multilevel)
Paul: I may have found the issue (which is similar to your conclusion). I checked using egsingle in the mlmRev package as these individuals are strictly nested in this case: library(mlmRev) library(nlme) fm1 <- lme(math ~ year, random=~1|schoolid/childid, egsingle) fm2 <- lmer(math ~ year +(1|schoolid:childid) + (1|schoolid), egsingle) Checking the summary of both models, the output is exactly the same w.r.t. the fixed effects, variance components, standard errors etc. The prior two lines of code fit the same models. However, the following does not generate s...
2004 Nov 26
1
help with glmmPQL
Hello: Will someone PLEASE help me with this problem. This is the third time I've posted it. When I appply anova() to two equations estimated using glmmPQL, I get a complaint, > anova(fm1, fm2) Error in anova.lme(fm1, fm2) : Objects must inherit from classes "gls", "gnls" "lm","lmList", "lme","nlme","nlsList", or "nls" > The two equations I estimated are these: > fm1 <- glmmPQL(choice ~ day + ste...
2006 Mar 16
1
lme4/Matrix: Call to .Call("mer_update_y"...) and LMEoptimize gives unexpected side effect...
Dear all I want to compute Monte Carlo p-values in lmer-models based on sampled data sets. To speed up calculations, I've tried to use internal functions from the Matrix package (as suggested ealier on the list by Doug Bates). So I did: fm2 <- lmer(resistance ~ ET + position + (1|Grp), Semiconductor,method='ML') simdata<-simulate(fm2,nsim=1) ynew <- simdata[,1] mer <- fm2 .Call("mer_update_y", mer, ynew, PACKAGE = "Matrix") mer1u <- LMEoptimize(mer, lmerControl(mer)) What puzzles me i...
2003 Jan 30
1
as.formula(string) and augPred in lme
Using formulas constructed from strings only partially works for me in lme: library(nlme) data(Orthodont) fm2<-lme(as.formula("distance~age"),data=Orthodont,random=~1|Subject) summary(fm2) # works augPred(fm2) # fails #Error in inherits(object, "formula") : #Argument "object" is missing, with no default I assume that my use of as.formula is wrong, but what's the right...
2011 Feb 06
1
anova() interpretation and error message
...870000 2 737.5400 0.5713333 3 894.5300 0.6393333 4 782.3800 0.5836667 5 857.5900 0.6003333 6 829.2700 0.5883333 I have fit the data using logistic, Michaelis?Menten, and linear model, they all give significance. > fm1 <- nls(Biomass~SSlogis(P, phi1, phi2, phi3), data=Ca.P.Biomass.A) > fm2 <- nls(Biomass~SSmicmen(P, phi1, phi2), data=Ca.P.Biomass.A) > fm3 <- lm(Biomass~P, data = Ca.P.Biomass.A) I hope to compare the difference among the three models, and I using anova(). As for the example here, the three models seem not have significant difference. However, I am confuse...
2005 Nov 17
1
anova.gls from nlme on multiple arguments within a function fails
...ample code --------------- library(nlme) ## stolen from example(anova.gls) # AR(1) errors within each Mare fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) anova(fm1) # variance changes with a power of the absolute fitted values? fm2 <- update(fm1, weights = varPower()) anova(fm1, fm2) ## now define a little function dummy <- function(obj) { anova(obj[[1]], obj[[2]]) } dummy(list(fm1, fm2)) ## compare with what happens in anova.lm: lm1 <- lm(follicles ~ sin(2*pi*Time), Ovary) lm2 <- lm(follicles ~ sin(2*p...
2009 Jun 25
2
Problems with subsets in NLME
I am trying to estimate models with subsets using the NLME package. However, I am getting an error in the case below (among others): > subset <- c(rep(TRUE, 107), FALSE) > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, subset=subset) Error in xj[i] : invalid subscript type 'closure' > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, subset=1:107) The second estimation works. Does anyone know if there is another work-ar...
2004 Nov 25
1
Error in anova(): objects must inherit from classes
Hello: Let me rephrase my question to attract interest in the problem I'm having. When I appply anova() to two equations estimated using glmmPQL, I get a complaint, > anova(fm1, fm2) Error in anova.lme(fm1, fm2) : Objects must inherit from classes "gls", "gnls" "lm","lmList", "lme","nlme","nlsList", or "nls" > The two equations I estimated are these: > fm1 <- glmmPQL(choice ~ day + stere...
2002 Jul 16
2
scale parameter and parameter vac-cov matrix in GEE
...id = loc, tol = 1e-10, corstr = "exchangeable") [1] "Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27" [1] "running glm to get initial regression estimate" [1] -0.7755188 -1.5240927 0.4769241 0.4682660 0.1776812 [6] 0.1219127 0.6949677 -1.0451064 > fm2 <- gee(nbtrp ~ strate * saison + offset(log(surf)), family = poisson, data = Eff2001, + id = loc, tol = 1e-10, corstr = "exchangeable", scale.fix = T, scale.value = 1) [1] "Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27" [1] "running glm to get in...
2006 Oct 08
2
latex and anova.lme problem
Dear R-helpers, When I try > anova(txtE2.lme, txtE2.lme1) Model df AIC BIC logLik Test L.Ratio p-value txtE2.lme 1 10 8590 8638 -4285 txtE2.lme1 2 7 8591 8624 -4288 1 vs 2 6.79 0.0789 > latex(anova(txtE2.lme, txtE2.lme1)) Error: object "n.group" not found I don't even see n.group as one of the arguments of latex() I checked to see >
1999 Apr 04
2
deparsing lhs of formula in print.anova.lm (PR#157)
Full_Name: Douglas Bates Version: Version 0.64.0 Unstable (April 3, 1999) OS: Debian GNU/Linux 2.1 Submission from: (NULL) (128.105.5.97) R> fm2 <- lm( 1/Surv ~ Poison + Antidote + Poison:Antidote, data = BC ) R> anova( fm2 ) Analysis of Variance Table Response: / Response: 1 Response: Surv Df Sum Sq Mean Sq F value Pr(>F) Poison 2 34.9 17.4 72.63 2.3e-13 *** Antidote 3 20.4 6.8...
2004 Apr 22
1
lme correlation structure error
...I am getting some very odd results. Here is what I am trying to run: library(nlme) data(Ovary) fm1<-lme(follicles~sin(2*pi*Time)+cos(2*pi*Time),data=Ovary,random=pdDiag(~s in(2*pi*Time))) ### The example is fine up to here with all parameter estimates being identical to that in the book. fm2<-update(fm1,correlation=corAR1()) #### The parameters of fm2 are different to that in the book and plot(ACF(fm2)) ##### signifies that serial correlation still exists in the residuals. ###### When I try and run this (which runs fine in the book) fm5<-update(fm1,corr=corARMA(p=1,q=1))...