[R-sig-ME] R-sig-mixed-models Digest, Vol 197, Issue 1

Ades, James j@de@ @end|ng |rom he@|th@uc@d@edu
Thu May 4 03:24:35 CEST 2023


Please disregard the first question: the more I thought about it, it would never work, and would need to have at least a 2nd years worth of data such that there are, indeed, repeated measures.

I am still wondering about the 2nd question though:
 I came across this site (https://urldefense.com/v3/__https://www.rensvandeschoot.com/tutorials/lme4/__;!!LLK065n_VXAQ!jHvnv_iDmN8LXetaCrE1EjKr0Le6u7XTjkKBpBOMfagy4xw0KGu0pV6izhlFrC8oeJFV3Tv_mU3c6PdzXtOpmNwYtZjeUSs$ ) in researching my question and was surprised that pupils were never added into this model (in popularity dataset, model output provided below), but still van de Schoot writes that If we look at the summary output we see under the Random Effects that the residual variance on the class level 0.7021 and residual variance on the first level (pupil level) is 1.2218. I'm surprised that van de Schoot is essentially saying that the residual variance is solely accounted for at the pupil level. Isn't there much error that won't be accounted for that can't merely be explained by pupil differences? I ask this question because I'm also thinking about my own application with Census Tracts. It is the first model on this webpage (would've screen shot, but it made the email too big): https://urldefense.com/v3/__https://www.rensvandeschoot.com/tutorials/lme4/__;!!LLK065n_VXAQ!jHvnv_iDmN8LXetaCrE1EjKr0Le6u7XTjkKBpBOMfagy4xw0KGu0pV6izhlFrC8oeJFV3Tv_mU3c6PdzXtOpmNwYtZjeUSs$ .

________________________________
From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> on behalf of r-sig-mixed-models-request using r-project.org <r-sig-mixed-models-request using r-project.org>
Sent: Wednesday, May 3, 2023 3:00 AM
To: r-sig-mixed-models using r-project.org <r-sig-mixed-models using r-project.org>
Subject: R-sig-mixed-models Digest, Vol 197, Issue 1

Send R-sig-mixed-models mailing list submissions to
        r-sig-mixed-models using r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!LLK065n_VXAQ!jHvnv_iDmN8LXetaCrE1EjKr0Le6u7XTjkKBpBOMfagy4xw0KGu0pV6izhlFrC8oeJFV3Tv_mU3c6PdzXtOpmNwYbl83j_s$
or, via email, send a message with subject or body 'help' to
        r-sig-mixed-models-request using r-project.org

You can reach the person managing the list at
        r-sig-mixed-models-owner using r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."


Today's Topics:

   1. Repeated measures in Census Tract Data: (Ades, James)

----------------------------------------------------------------------

Message: 1
Date: Tue, 2 May 2023 18:25:33 +0000
From: "Ades, James" <jades using health.ucsd.edu>
To: "r-sig-mixed-models using r-project.org"
        <r-sig-mixed-models using r-project.org>
Subject: [R-sig-ME] Repeated measures in Census Tract Data:
Message-ID:
        <BY5PR19MB38591E73A61398811E9E91B5EA6F9 using BY5PR19MB3859.namprd19.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

Hi all,

I am returning to multilevel models after a two-year program in ML techniques.

What I'm doing is nothing fancy, just accounting for the fact that different census tract variables (like median income, median house value, population density, percent those living in same house as they did a year ago, income disparity, percent white/black/Asian race, etc.) will be correlated.

There is 1 GEOID per row (sample of first four rows with reduced columns):
```
df  =
structure(list(kfr_pooled_pooled_p25 = c(0.45727569, 0.51709598,
0.45559084, 0.42194119), GEOID = c(6073000100, 6073000201, 6073000202,
6073000300), lognorm_crime = c(3.25809653802148, 3.66356164612965,
4.49980967033027, 4.00733318523247), median_hh_ = c(138879, 88125,
76658, 68679), income_gin = c(0.533, 0.5175, 0.459, 0.4416),
    per_white = c(0.907856450048497, 0.877313590692755, 0.857551739321885,
    0.852452758159954), per_black = c(0, 0.005288207297726, 0.000880669308675,
    0.061462111089903)), row.names = c(NA, -4L), class = c("tbl_df",
"tbl", "data.frame"))
```

I was surprised to get this error (number of levels of each grouping factor must be < number of observations) in specifying a null model:
```null = lmer(opportunity_score ~ 1 + (​1|GEOID), df, REML = FALSE, control = lmerControl(optimizer = "bobyqa"))​​```

Which brought me to this post: https://urldefense.com/v3/__https://stackoverflow.com/questions/19713228/lmer-error-grouping-factor-must-be-number-of-observations__;!!LLK065n_VXAQ!jHvnv_iDmN8LXetaCrE1EjKr0Le6u7XTjkKBpBOMfagy4xw0KGu0pV6izhlFrC8oeJFV3Tv_mU3c6PdzXtOpmNwYVTxWQe0$  with Ben (Bolker). And it seems that I was just mistaken, as I thought the 1|GEOID would account for the correlation among subsequent variables within a GEOID. So is the only way to account for the dependence of these values to create a long dataset and then build out the model accordingly: let's say you wanted to build bivariate models regressing an opportunity score on each individual variable, you'd have to filter out only that individual variable (creating many different datasets)?

Also, as a follow-up question, I came across this site (https://urldefense.com/v3/__https://www.rensvandeschoot.com/tutorials/lme4/__;!!LLK065n_VXAQ!jHvnv_iDmN8LXetaCrE1EjKr0Le6u7XTjkKBpBOMfagy4xw0KGu0pV6izhlFrC8oeJFV3Tv_mU3c6PdzXtOpmNwYtZjeUSs$ ) in researching my question and was surprised that pupils were never added into this model (in popularity dataset, model output provided below), but still van de Schoot writes that If we look at the summary output we see under the Random Effects that the residual variance on the class level 0.7021 and residual variance on the first level (pupil level) is 1.2218. I'm surprised that van de Schoot is essentially saying that the residual variance is solely accounted for at the pupil level. Isn't there much error that won't be accounted for that can't merely be explained by pupil differences? I ask this question because I'm also thinking about my own application with Census Tracts. It is the first model on this webpage (would've screen shot, but it made the email too big): https://urldefense.com/v3/__https://www.rensvandeschoot.com/tutorials/lme4/__;!!LLK065n_VXAQ!jHvnv_iDmN8LXetaCrE1EjKr0Le6u7XTjkKBpBOMfagy4xw0KGu0pV6izhlFrC8oeJFV3Tv_mU3c6PdzXtOpmNwYtZjeUSs$ .

Thanks!

James



        [[alternative HTML version deleted]]



------------------------------

Subject: Digest Footer

_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-models using r-project.org
https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!LLK065n_VXAQ!jHvnv_iDmN8LXetaCrE1EjKr0Le6u7XTjkKBpBOMfagy4xw0KGu0pV6izhlFrC8oeJFV3Tv_mU3c6PdzXtOpmNwYbl83j_s$


------------------------------

End of R-sig-mixed-models Digest, Vol 197, Issue 1
**************************************************

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list