Skip to content

Commit

Permalink
20250219 - sex as a predictor of the intercepts and slopes
Browse files Browse the repository at this point in the history
  • Loading branch information
isaactpetersen committed Feb 20, 2025
1 parent b1c3bd3 commit 4dfdac1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hlm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ ggplot(

```{r}
linearMixedModel <- lmer(
math ~ female + ageYearsCentered + (1 + ageYearsCentered | id),
math ~ female + ageYearsCentered + female:ageYearsCentered + (1 + ageYearsCentered | id), # random intercepts and slopes; sex as a fixed-effect predictor of the intercepts and slopes
data = mydata,
REML = FALSE, #for ML
na.action = na.exclude,
Expand Down Expand Up @@ -197,8 +197,8 @@ ranef(linearMixedModel)

```{r}
linearMixedModel_nlme <- lme(
math ~ female + ageYearsCentered,
random = ~ 1 + ageYearsCentered|id,
math ~ female + ageYearsCentered + female:ageYearsCentered, # sex as a fixed-effect predictor of the intercepts and slopes
random = ~ 1 + ageYearsCentered|id, # random intercepts and slopes
data = mydata,
method = "ML",
na.action = na.exclude)
Expand Down

0 comments on commit 4dfdac1

Please sign in to comment.