Questions tagged [multilevel-analysis]

Statistical methods appropriate for the analysis of data sets comprising several levels of hierarchy of units of analysis (e.g., students nested in classes nested in schools; observations nested in patients nested in hospitals). If you can refer to more specific models like mixed-model or glmm, please do so.

Overview

"Multilevel analysis is a general term referring to statistical methods appropriate for the analysis of data sets comprising several types of unit of analysis. The levels in the multilevel analysis are another name for the different types of unit of analysis. Each level of analysis will correspond to a population, so that multilevel studies will refer to several populations..."

-T.A.B. Snijders, Multilevel Analysis, p. 673-677 in M. Lewis-Beck, A.E. Bryman, and T.F. Liao (eds.), The SAGE Encyclopedia of Social Science Research Methods (Volume II). Sage, 2003.

Related tags

  • for linear multilevel models, or HLMs
  • for models with random intercepts
  • for models with random intercepts and slopes
  • for generalized linear mixed models (binary, ordinal, count response)
  • and for R implementations
  • for Stata implementation
  • for Bayesian models comprising several levels of hierarchy of priors and hyperpriors

Please use these tags to make your question more specific and easier to find.

164 questions
1
vote
0 answers

How can I specify an informative prior for a stan_lmer multilevel model in rstanarm?

I'm creating a Bayesian multilevel model in rstanarm to predict satisfaction by party identity in each year (using year as the second level), with demographic controls. (I'm new to rstanarm so my syntax may be off). The formula is: stanmodel_levels…
1
vote
1 answer

Restructuring 2-level data to 3-level data

I have a two-level multilevel data. Below is an example of it. I have two participants that reported their fruits consumption for two days. id day apple orange 1 1 34 12 1 2 54 43 2 1 65 56 2 2 87 81 I want to…
1
vote
1 answer

Multilevel R squared error in package 'mitml'

I am trying to use the package 'mitml' in R to calculate R squared measures for a multilevel model. I have tried using lme4 and nlme to specify my models. However, when I use lme4 to specify the model the R squared values are the same across all 4…
1
vote
1 answer

Estimating Fixed Effects without Random Effects

Probably basic question, but I'm not aure how to do it. If one wants to estimate a multilevel model, but only with fixed effects, not random effects estimated, how one would do that? For example, here is my model: model4 <- lmer(m ~ x + ( | id) ,…
Sarah
  • 11
  • 2
1
vote
1 answer

Generalized Additive Mixed Model (GAMM) in R mgcv Package Formula Implementation for Grouping Variable

I am attempting to use mgcv to model a non-linear multilevel model with Time as the primary independent variable + a level 2 covariate (Xc). Because these data are within-person, I would like the model to reflect the within-person responses at level…
aspark2020
  • 341
  • 2
  • 17
1
vote
0 answers

How do I get merTools/ lme4 to report p values for multiply imputed data?

I am using the R packages lme4, merTools and Amelia to run a multi-level model with multiply imputed data. The merTools function "print.summary.merModList" gives the model results, including for the fixed effects part of the model (it gives the…
Thoraya
  • 11
  • 1
1
vote
2 answers

Arrage dataframe based on the data presence in columns in multilevel dataframe

I have a multilevel columns in the pandas df with the index as appid as follows: year |2016 2017 2018 2019 2016 2017 2018 2019 |ttl ttl ttl ttl tta tta tta …
abhi1610
  • 721
  • 13
  • 28
1
vote
2 answers

Are lmer-coefficients standardized or not?

I have a very basic question; maybe a bit too basic to find a helpful response googeling it. I am calcultating multi-level-models using the lmer function using this code: lmer(H1_rirs, data= df_long_cl, REML = T) Am I right in assuming that the…
1
vote
1 answer

Multilevel Pandas Iteration of Complex Dataframe

My data appears like below, which is a multilevel pandas dataframe, which I'm trying to run some operations on; but need help accessing specific levels... print(df.head()) FB AMZN …
billv1179
  • 323
  • 5
  • 15
1
vote
0 answers

How to include diary data/lagged data in multilevel regression code

I work with diary data and I am trying to do a multilevel regression with a lagged variable. I try to predict a binary variable from a continuous variable of the previous day and To predict a continuous variable from a binary variable of the…
Anna
  • 11
  • 1
1
vote
0 answers

How to simulate intraclass correlated data?

I'm simulating a random dataset for a mixed-model. For mixed-model to make sense, the data points within a cluster need to be correlated (ICC). How do I generate such data? These are my variables: ID base (baseline, first measurement) half (second…
1
vote
1 answer

What do you set grouping factor to when using glmer/lme4 and predictInterval?

Problem: Using multilevel (mixed-effects) model and not sure what to set grouping variable to in order to generate predicted probabilities for a measured group-level variable from glmer model using merTools' predictInterval function. Goal: Generate…
tall_table
  • 311
  • 3
  • 11
1
vote
0 answers

Is it possible to perform a multivevel segmented poisson regression for a time series design in R?

for my research project, I am investigating the effect of a policy change on certain outcomes, e.g. crime rate. Multiple countries adapted the new policy at different time points or better, in different years. So far, I have performed a time series…
lisannceline
  • 113
  • 5
1
vote
1 answer

Grouping Variables in Multilevel Linear Models

I am trying to learn hierarchical models in R and I have generated some sample data for myself. I am having trouble with the correct syntax for coding a multilevel regression problem. I generated some data for salaries in a Business school. I made…
1
vote
0 answers

How to get AIC or BIC for glmmPQL (from nlme package)

I am using glmmPQL (from nlme package) to run a multi-level glm with a dummy outcome. Unfortunately glmmPQL does not provide fit measures such as AIC, or BIC. I was wondering if there is a package that can calculate AIC, and BIC fromglmmPQL results.
UseR2001
  • 29
  • 4