similar to: lme4 question

Displaying 20 results from an estimated 6000 matches similar to: "lme4 question"

2008 Oct 16
1
lmer for two models followed by anova to compare the two models
Dear Colleagues, I run this model: mod1 <- lmer(x~category+subcomp+category*subcomp+(1|id),data=impchiefsrm) obtain this summary result: Linear mixed-effects model fit by REML Formula: x ~ category + subcomp + category * subcomp + (1 | id) Data: impchiefsrm AIC BIC logLik MLdeviance REMLdeviance 4102 4670 -1954 3665 3908 Random effects: Groups Name Variance
2012 Jun 06
3
Sobel's test for mediation and lme4/nlme
Hello, Any advice or pointers for implementing Sobel's test for mediation in 2-level model setting? For fitting the hierarchical models, I am using "lme4" but could also revert to "nlme" since it is a relatively simple varying intercept model and they yield identical estimates. I apologize for this is an R question with an embedded statistical question. I noticed that a
2011 Sep 12
1
Multilevel model in lme4 and nlme
Dear list, I am trying to fit some mixed models using packages lme4 and nlme. I did the model selection using lmer but I suspect that I may have some autocorrelation going on in my data so I would like to have a look using the handy correlation structures available in nlme. The problem is that I cannot translate my lmer model to lme: mod1<- lmer(y~x + (1|a:b) + (1|b:c), data=mydata)
2010 Jan 28
2
Data.frame manipulation
Hi All, I'm conducting a meta-analysis and have taken a data.frame with multiple rows per study (for each effect size) and performed a weighted average of effect size for each study. This results in a reduced # of rows. I am particularly interested in simply reducing the additional variables in the data.frame to the first row of the corresponding id variable. For example:
2010 Feb 15
2
creating functions question
Hi All, I am interested in creating a function that will take x number of lm objects and automate the comparison of each model (using anova). Here is a simple example (the actual function will involve more than what Im presenting but is irrelevant for the example): # sample data: id<-rep(1:20) n<-c(10,20,13,22,28,12,12,36,19,12,36,75,33,121,37,14,40,16,14,20)
2010 Jul 09
1
output without quotes
Hi All, I am interested in printing column names without quotes and am struggling to do it properly. The tough part is that I am interested in using these column names for a function within a function (e.g., lm() within a wrapper function). Therefore, cat() doesnt seem appropriate and print() is not what I need. Ideas? # sample data mod1 <- rnorm(20, 10, 2) mod2 <- rnorm(20, 5, 1) dat
2011 Oct 26
2
Error in summary.mlm: formula not subsettable
When I fit a multivariate linear model, and the formula is defined outside the call to lm(), the method summary.mlm() fails. This works well: > y <- matrix(rnorm(20),nrow=10) > x <- matrix(rnorm(10)) > mod1 <- lm(y~x) > summary(mod1) ... But this does not: > f <- y~x > mod2 <- lm(f) > summary(mod2) Error en object$call$formula[[2L]] <- object$terms[[2L]]
2003 Feb 10
2
problems using lqs()
Dear List-members, I found a strange behaviour in the lqs function. Suppose I have the following data: y <- c(7.6, 7.7, 4.3, 5.9, 5.0, 6.5, 8.3, 8.2, 13.2, 12.6, 10.4, 10.8, 13.1, 12.3, 10.4, 10.5, 7.7, 9.5, 12.0, 12.6, 13.6, 14.1, 13.5, 11.5, 12.0, 13.0, 14.1, 15.1) x1 <- c(8.2, 7.6,, 4.6, 4.3, 5.9, 5.0, 6.5, 8.3, 10.1, 13.2, 12.6, 10.4, 10.8, 13.1, 13.3, 10.4, 10.5, 7.7, 10.0, 12.0,
2013 Nov 25
4
lmer specification for random effects: contradictory reults
Hi All, I was wondering if someone could help me to solve this issue with lmer. In order to understand the best mixed effects model to fit my data, I compared the following options according to the procedures specified in many papers (i.e. Baayen <http://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDsQFjAA
2010 Feb 20
3
aggregating using 'with' function
Hi All, I am interested in aggregating a data frame based on 2 categories--mean effect size (r) for each 'id's' 'mod1'. The 'with' function works well when aggregating on one category (e.g., based on 'id' below) but doesnt work if I try 2 categories. How can this be accomplished? # sample data id<-c(1,1,1,rep(4:12)) n<-c(10,20,13,22,28,12,12,36,19,12,
2009 Oct 21
1
How to find the interception point of two linear fitted model in R?
Dear All, Let have 10 pair of observations, as shown below. ###################### x <- 1:10 y <- c(1,3,2,4,5,10,13,15,19,22) plot(x,y) ###################### Two fitted? models, with ranges of [1,5] and [5,10],?can be easily fitted separately by lm function as shown below: ####################### mod1 <- lm(y[1:5] ~ x[1:5]) mod2 <- lm(y[5:10] ~ x[5:10]) #######################
2006 Aug 29
2
lattice and several groups
Dear R-list, I would like to use the lattice library to show several groups on the same graph. Here's my example : ## the data f1 <- factor(c("mod1","mod2","mod3"),levels=c("mod1","mod2","mod3")) f1 <- rep(f1,3) f2 <-
2008 Sep 08
1
correct lme syntax for this problem?
Hello all, I am about to send off a manuscript and, although I am fairly confident I have used the lme function correctly, I want to be 100% sure. Could some kind soul out there put my mind at ease? I am simply interested in whether a predictor (SPI) is related to height. However, there are five different populations, and each may differ in mean level of height as well as the relationship
2011 Jul 22
1
how to fix coefficients in regression
Hello all, I am using a glm() and would like to fix one of the regression coefficients to be a particular value and see what happens to the fit of the model. E.g.: mod1 <- glm(Y ~ X1 + X2,family='binomial') mod2 <- glm(Y~[fixed to 1.3]X1 + X2,family='binomial') The beta for X1 is freely estimated in mod1 but is constrained to be 1.3 in mod2. Is there a way to do this?
2006 Jul 21
1
Parameterization puzzle
Consider the following example (based on an example in Pat Altham's GLM notes) pyears <- scan() 18793 52407 10673 43248 5710 28612 2585 12663 1462 5317 deaths <- scan() 2 32 12 104 28 206 28 186 31 102 Smoke <- gl(2,1,10,labels=c("No","Yes")) Age <- gl(5,2,10,labels=c("35-44","45-54","55-64","65-74","75-84"),
2009 Apr 03
1
Trouble extracting graphic results from a bootstrap
Hi, I'm trying to extract a histogram over the results from a bootstrap. However I keep receiving the error message "Error in hist.default(boot.lrtest$ll, breaks = "scott") : 'x' must be numeric". The bootstrap I'm running looks like: > boot.test <- function(data, indeces, maxit=20) { + y1 <- fit1+e1[indeces] + mod1 <- glm(y1 ~ X1-1, maxit=maxit) +
2010 Aug 03
1
"glmulti": defining which intractions between variables are to be included
Hello, I'm using the "glmulti" package to run models of all the possible combinations of my variables. However, I am only interested in a few interactions between my variables. I have tried the equivalent of: mod1<-lm(y~a+b+c+a:b) glmulti(mod1, level=1) mod2<-lm(y~a+b+c+a:b) glmulti(mod2, level=2) and glmulti("y", c("a", "b", "c"),
2012 Jun 12
1
Two-way linear model with interaction but without one main effect
Hi, I know that the type of model described in the subject line violates the principle of marginality and it is rare in practice, but there may be some circumstances where it has sense. Let's take this imaginary example (not homework, just a silly made-up case for illustrating the rare situation): I'm measuring the energy absorption of sports footwear in jumping. I have three models (S1,
2010 Feb 17
1
Replicating output from a function
Hi All, I have a function that is used with data frames having multiple id's per row and it aggregates the data down to 1 id per row. It also randomly selects one of the within-id values of a variable (mod), which often differ within-id. Assume this data frame (below) is much larger and I want to repeat this function, say 100 times, and then derive the mean values of r over those 100
2011 Apr 07
1
Automated Fixed Order Stepwise Regression Function
Greetings, I am interested in creating a stepwise fixed order regression function. There's a function for this already called add1( ). The F statistics are calculated using type 2 anova (the SS and the F changes don't match SPSS's). You can see my use of this at the very end of the email. What I want: a function to make an anova table with f changes and delt R^2. I ran into