Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 140365

Statistical analysis of datasets comprising several levels of hierarchy (e.g., students nested in classes nested in schools or hierarchical forecasting). For questions about mixed models use [mixed-model] tag. For nested random effects, use [nested-data].

2 votes
1 answer
189 views

How multi-level models account for correlation and what kinds of correlations?

Multi-level models are often shown using figures such as below. These pictures say that observed data at the lowest level (BLUE TRIANGLES) come from some independent populations (BLUE CURVES). But the …
rnorouzian's user avatar
  • 4,056
1 vote
0 answers
27 views

Modeling nestedness in terms of repeated measures AND site in lme4 in R?

I have $30$ students from $4$ schools (named: W, X, Y, Z). Two of the schools (X and Y) have received a Treatment (T), and two other schools (W and Z) served as control (C). I have tested all student …
rnorouzian's user avatar
  • 4,056
4 votes
2 answers
1k views

controlling for clustering at id level in mixed effects model

I have one group ($n=40$) of subjects pre- and post-tested (time; coded $0$ and $1$) on a continuous variable (y). I also have a gender variable coded $0$ and $1$. Using R, I was wondering how I coul …
rnorouzian's user avatar
  • 4,056
5 votes
1 answer
973 views

Are time points nested in students or crossed in a longitudinal multi-level model

I often hear that in a longitudinal multi-level analysis, time points (as a fixed factor) are "nested" within students (e.g., just search the word $nest$ in this paper). However, this great answer ver …
rnorouzian's user avatar
  • 4,056
3 votes
1 answer
132 views

Are priors in Bayesian inference similar to levels in mixed-effects models?

I often see a frequentist multi-level model (MLM) structure is defined like so (made up parameters): $$ \theta_i \sim \mathcal{N}(10, 2.5) $$ $$y_{i,j} \sim \mathcal{N}(\theta_i, 0.5) $$ But this is e …
rnorouzian's user avatar
  • 4,056
4 votes
2 answers
289 views

Obtaining correlation between random-effects separately for 2 groups

I'm following up on this great answer. Suppose I have a cross-level interaction in my mixed-effects model below (ses*sector). My cluster-level predictor "sector" is a binary variable (0=Public, 1=Priv …
rnorouzian's user avatar
  • 4,056
5 votes
1 answer
1k views

Visualizing the folly of fitting random slopes for variables that don't vary within groups

Sometime I encounter wrong mixed-models that run without warning. By wrong, I mean logically nearly impossible. Think of a cross-level interaction that is set by the software syntax to AGAIN vary acro …
rnorouzian's user avatar
  • 4,056
2 votes
0 answers
56 views

Can a grouping variable also be a predictor or vice versa

I sometimes see that a grouping variable such as study ($1,2,...15$) is used as a grouping variable to the right of the |: metafor::rma.mv(yi, vi, random = ~ 1 | district/study, data=dat) (see HERE) B …
rnorouzian's user avatar
  • 4,056
4 votes
1 answer
1k views

Standard error in multi-level models vs. non-multi-level models

Gelman & Hill (pp. 252-259) discuss "no-pooling" (single-level), and "partial-pooling regression" (multi-level) with no predictor ($section~ 12.2$). In almost all mixed-effects models (i.e, partial-po …
rnorouzian's user avatar
  • 4,056
3 votes
1 answer
641 views

Defining the model syntax of an lme() model based on an nlme() model

I'm trying to replicate the output of mg4.math.nlme model fit via nlme() function, using the lme() function in mg5.math.lme model. I'm wondering how I should define the fixed and random part of my lm …
rnorouzian's user avatar
  • 4,056
3 votes
1 answer
107 views

Detecting Random & Crossed Random-Effects from Model Syntax in R (lme4)

I'm following-up on this question, and inspired by this great answer. I have 3 lme4 longitudinal mixed-models. Throughout, y is the response variable, group is a binary indicator for "control" vs. "tr …
rnorouzian's user avatar
  • 4,056
4 votes
1 answer
46 views

Manually dummy-coded variable works but its factor version fails in a mixed model

In my dataset, I have created two variables from a binary factor called name. Specifically Dl = as.numeric(name == "lnw") and De = as.numeric(name == "exper"). Now, when I fit two equivalent models: m …
rnorouzian's user avatar
  • 4,056
8 votes
1 answer
438 views

How can a cross-level interaction be random in a 2-level mixed-model?

I was wondering why m below is a legitimate model? If it is, what is the meaning of its random part? ses is a level-1 predictor and sector a level-2 predictor making their combinations a cross-level i …
rnorouzian's user avatar
  • 4,056
4 votes
1 answer
1k views

singular covariance matrices = estimates of zero random-effects variance in a model with ran...

I was wondering why for mixed-effects models that have degenerate or singular covariance matrices (some linear combinations of the random effects are estimated to having no variability) are said to co …
rnorouzian's user avatar
  • 4,056
9 votes
1 answer
5k views

Demonstrating complete-pooling, no-pooling, and partial-pooling regression in R

Gelman & Hill (pp. 255-259) demonstrate in R how to achieve a "complete-pooling regression", "no-pooling regression", and "partial-pooling regression". I don't have their data to replicate what they d …
rnorouzian's user avatar
  • 4,056

15 30 50 per page