# Tag Info

10

Your question(s) is a little bit "big", so I'll start with some general comments and tips. Some background reading and useful packages You should probably take a look at some of the tutorial introductions to using mixed models, I would recommend starting with Baayen et al (2008) -- Baayen is the author of languageR. Barr et al (2013) discuss some issues ...

8

(Italics represent corrected text) You are making a 'mistake' in your model specification given what you say you want. Random effects: Groups Name Variance Std.Dev. Corr Item (Intercept) 273.508 16.5381 Subject Gramgram 0.000 0.0000 Gramungram 3717.213 60.9689 ...

7

The estimate, ID's variance = 0, indicates that the level of between-group variability is not sufficient to warrant incorporating random effects in the model; ie. your model is degenerate. As you correctly identify yourself: most probably, yes; ID as a random effect is unnecessary. Few things spring to mind to test this assumption: You could compare ...

6

If you have repeated measures then you should defnintely be able to use the longpower package. This implements the sample size calculations in Liu and Liang (1997) and Diggle et al (2002). The documentation has example code. Here's one, using the lmmpower() function: > require(longpower) > require(lme4) > fm1 <- lmer(Reaction ~ Days + ...

6

Mixed models are (generalized versions of) variance components models. You write down the fixed effects part, add error terms that may be common for some groups of observations, add link function if needed, and put this into a likelihood maximizer. The various variance structures you are describing, however, are the working correlation models for the ...

5

The lmer function requires multiple measures / random effect (at least for some of them). Furthermore, the grouping factor in the random effect is typically nominal values, not continuous. You say X2 is continuous yet you tell the model that the intercept is grouped by it as a random effect. Either you just want straight linear modelling here or something ...

5

(Converted from a comment.) I would say lmer would be pretty good with a random effect of year and a random effect of customer (let's say you only have one measurement per customer per year); lmer(y~1 + (1|year) + (1|customer), ...) would fit the (intercept-only) model $$Y_{ij} \sim \text{Normal}(a + \epsilon_{\text{year},i} + ... 5 To test a intercept less model (but including f1) you need to simply specify it (both ways are equivalent): m3 <- lmer(x ~ 0 + f1 + (1|ID) + (0 + f1|ID), data) or m3 <- lmer(x ~ f1 + (1|ID) + (0 + f1|ID) - 1, data) and then compare those: KRmodcomp(m1, m3) You can also get a test of all effects in (including the intercept) using function mixed ... 5 Consider a linear model like$$\mathbb{E}[Y] = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \beta_3 (X_1 \times X_2).$$When X_1 and X_2 are categorical, this is pure nonsense until somehow the categories have been encoded as numbers. The default in R, for binary categories, is to encode the first category as 0 and the second as 1. Let the categories ... 5 Yes, there is a consensus: you should use the variances, not the standard deviations, in computing the intra-class correlation (ICC). The two-level random-intercept-only model is$$ y_{ij} = \beta_0 + u_{0j} + e_{ij},  where the random intercepts $u_{0j}$ have variance $\sigma^2_{u_0}$ and the residuals $e_{ij}$ have variance $\sigma^2_e$. Now, the ...

5

Some of the things in formula are a bit confusing. The : is for interactions between two terms while the * is for main effects and interactions. The / is another one for interactions but what it does is generate an interaction between the numerator and all of the terms in the denominator (e.g. A/(B+C) = A:B + A:C). The | is for something like "grouped by". ...

5

Tow nested within station when tow is random and station is fixed station+(1|station:tow) is correct. As @John said in his answer, (1|station/tow) would expand to (1|station)+(1|station:tow) (main effect of station plus interaction between tow and station), which you don't want because you have already specified station as a fixed effect. Interaction ...

5

A reference can be found in footnote 1 of Baayen, R. H., Davidson, D. J., & Bates, D. M. (2008). Mixed-effects modeling with crossed random effects for subjects and items. Journal of Memory and Language, 59(4), 390–412. I'm quoting the relevant bits here: For data sets characteristic for studies of memory and language, which typically comprise many ...

4

No, it is not a problem. The correlation arises from the fact that your two categorical predictors are entered as dummy codes, and are therefore not orthogonal to the interaction term, even in the case of balanced data. So we fully expect both the predictors themselves (i.e., the vectors of predictor values) and the parameter estimates to be correlated. It ...

4

I don't think the fact that this is longitudinal data changes any of the usual points about this sort of analysis: 1) If you have an interaction term in your model, you want all the main effects involved in the interaction in your model (with very rare exceptions) 2) We shouldn't choose variables exclusively by whether they are significant - they can also ...

3

Welcome to the site. This has been discussed many times here, e.g. this question Briefly, it is very rarely a good idea to include an interaction term in a model without the main effects, and the main effects do not have a simple interpretation when there is an interaction.

3

As @Mike Lawrence mentioned the obvious thing to do when defining a model without fixed effects is something in the form of: lmer(y ~ -1 + (1|GroupIndicator)) which is actually quite straightforward; one defines no intercept or an X matrix. The basic reason which this doesn't work out is that as @maxTC pointed out "lme4 package is dedicated to mixed ...

3

I get the impression you're just trying to basically do a repeated measures ANOVA but using multi-level modelling. You'll generally need to look up information on multiple regression and understand that well in order to step into the world of multi-level modelling. You should look through the site at the many many questions on using lmer. Your model is ...

3

I am the original author of the getSummary.mer function. The reported $p$-values should only be used as a quick check. If I recall, I actually only included the $p$-values to make it work within the framework provided by memisc. But this should really be provided with an appropriate warning to the user, and I will contact the package maintainer to see about ...

3

When in doubt, look at the raw data: library(ggplot2) theme_set(theme_bw()) ggplot(dat,aes(pos.centered,diff,colour=cond.lag))+geom_point()+ geom_line(aes(group=sub:cond.lag),alpha=0.4) ggsave("SE_ex.png",width=6,height=4) (You could also try colour=sub and facet_grid(.~cond.lag)) It looks like your problem is the explosion of variance for centered ...

3

Here is an example of the reporting to which you refer. We took the Baayen article seriously and report only AIC differences and t-values in a relatively large analysis of several variables. We emphasized effect sizes and no p-values appear!

2

According to the [XT] manual for Stata 11: Standard errors for BLUPs are calculated based on the iterative technique of Bates and Pinheiro (1998, sec. 3.3) for estimating the BLUPs themselves. If estimation is done by REML, these standard errors account for uncertainty in the estimate of $\beta$, while for ML the standard errors treat $\beta$ as ...

2

I know this is probably too late for your benefit, but perhaps for others I will provide an answer. You can include time-varying covariates in a longitudinal random-effects models (see Applied Longitudinal Analysis by Fitzmaurice, Laird and Ware, 2011 and http://www.ats.ucla.edu/stat/r/examples/alda/ specifically for R – use lme). Interpretation of trends ...

2

I think that you don't have to include trial as a random factor (unless it makes any sense, but you said they were just repetitions in random order). You only have to declare subjects as a random factor and R will detect that you have 4 observations per subject*B cell. Check df in the output (if you use nlme) to confirm. In a classical ANOVA-design context, ...

2

To my knowledge lmer is not having an "easy" way to address this. Also given that in most cases lmer makes heavy use of sparse matrices for Cholesky factorization I would find it unlikely that it allows for totally unstructured VCV's. To your address your question on "default structure": there is not a concept of default; depending on how you define your ...

2

For a quick way to get at the standardized beta coefficients directly from any lm (or glm) model in R, try using lm.beta(model) from the QuantPsyc package. For example: library("MASS") glmModel = glm(dependentResponseVar ~ predictor1 + predictor2, data=myData) summary(glmModel) library(QuantPsyc) lm.beta(glmModel)

2

Correlation of Fixed Effects: refers to the estimated correlation between the fixed-effect parameters (Intercept) and GroupTreatment*. Usually these correlations arise when the data is not centered. You can center continuous data by subtracting the mean. This will avoid slope-intercept correlations and thus make the interpretation of main effects more ...

2

For anything beyond the simple 2 sample tests I prefer to use simulation for sample size or power studies. With prepackaged routines you can sometimes see large differences between the results from the programs based on the assumptions that they are making (and you may not be able to find out what those assumptions are, let alone if they are reasonble for ...

2

I think your specification is fine. I'm not so sure you'll end up needing to let every single slope vary randomly, but it's a start I suppose. One thing you might want to try is allowing the random effects to be correlated. The way you specify the random effects (1|Id)+(var1|Id)+... ensures that zero correlations among the random effects are imposed. If you ...

2

Q1: Yes, it is not trivial. Please check the following link http://glmm.wikidot.com/faq under the section How do I compute a coefficient of determination (R2), or an analogue, for (G)LMMs? as provides a quite good treatment of the issue; small 3-4 liners of code are presented that calculate an $R^2$ like measure. A rather helpful reference of the subject ...

Only top voted, non community-wiki answers of a minimum length are eligible