An Introduction to the Structured Life Course Modeling Approach
University of Michigan
November 13, 2026
I’m Just a Padawan
Some materials have been adapted from Dr. Andrew Smith, who is a true Jedi Master. I am grateful and humbled by the opportunity to learn from him.
slcma Package
Part 6 · Time Permitting
Additional Topics
Where We Are
What We Need

Structured
Life
Course
Modeling
Approach

Which life course hypothesis best fits our data?
Fit a regression model for each single life course hypothesis of interest, as well as groups of compound hypotheses
Measure the goodness-of-fit of each model and select the best one
Calculate appropriate p-values for the selected model
Big 3
Others
\[\mathit{SP}_j = x_j\]
Multiple time points can also be grouped into more meaningful sensitive periods.

\[\mathit{Acc} = \sum_{j=1}^m{x_j}\]
Example
| ID | Exp1 | Exp2 | Exp3 | Acc |
|---|---|---|---|---|
| 1 | 0 | 0 | 0 | \(0 + 0 + 0 = 0\) |
| 2 | 1 | 1 | 1 | \(1 + 1 + 1 = 3\) |
| 3 | 0 | 1 | 0 | \(0 + 1 + 0 = 1\) |
| 4 | 1 | 0 | 0 | \(1 + 0 + 0 = 1\) |
| 5 | 1 | 0 | 1 | \(1 + 0 + 1 = 2\) |
\[\mathit{Rec} = \sum_{j=1}^m{\left(x_jt_j\right)}\]
Example
| ID | Exp1 | Exp2 | Exp3 | Rec |
|---|---|---|---|---|
| 1 | 0 | 0 | 0 | \((0 \times 1) + (0 \times 2) + (0 \times 3) = 0\) |
| 2 | 1 | 1 | 1 | \((1 \times 1) + (1 \times 2) + (1 \times 3) = 6\) |
| 3 | 0 | 1 | 0 | \((0 \times 1) + (1 \times 2) + (0 \times 3) = 2\) |
| 4 | 1 | 0 | 0 | \((1 \times 1) + (0 \times 2) + (0 \times 3) = 1\) |
| 5 | 1 | 0 | 1 | \((1 \times 1) + (0 \times 2) + (1 \times 3) = 4\) |
# set seed
set.seed(1234)
# simulate exposure & outcome data
n <- c(141, 20, 88, 80, 40, 35, 317, 367)
y <- c(28.7, 27.5, 29.1, 27.8, 28.3, 27.1, 27.6, 26.0)
se <- c(0.5, 1.1, 0.7, 0.7, 0.8, 0.9, 0.3, 0.2)
sp04 <- rep(c(0, 1, 0, 0, 1, 1, 0, 1), times = n)
sp26 <- rep(c(0, 0, 1, 0, 1, 0, 1, 1), times = n)
sp43 <- rep(c(0, 0, 0, 1, 0, 1, 1, 1), times = n)
e <- lm(rnorm(sum(n)) ~ sp04 * sp26 * sp43)$residuals
y <- rep(y, n) + rep(se * sqrt(n), n) * e / sd(e)
# create data frame
dats_bin <- data.frame(cbind(y, sp04, sp26, sp43))
# clean up
rm(n, y, se, sp04, sp26, sp43, e)Which single hypothesis best fits our data?
Call:
lm(formula = y ~ sp04, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-21.6360 -3.3888 -0.1199 3.0812 20.1639
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 28.0842 0.2092 134.219 < 2e-16 ***
sp04 -1.7368 0.3211 -5.409 7.8e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.235 on 1086 degrees of freedom
Multiple R-squared: 0.02623, Adjusted R-squared: 0.02534
F-statistic: 29.26 on 1 and 1086 DF, p-value: 7.8e-08
Which single hypothesis best fits our data?
Call:
lm(formula = y ~ sp26, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-20.6257 -3.4331 -0.3213 3.2145 21.1742
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 28.1493 0.3181 88.494 < 2e-16 ***
sp26 -1.0754 0.3682 -2.921 0.00357 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.285 on 1086 degrees of freedom
Multiple R-squared: 0.007793, Adjusted R-squared: 0.00688
F-statistic: 8.53 on 1 and 1086 DF, p-value: 0.003566
Which single hypothesis best fits our data?
Call:
lm(formula = y ~ sp43, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-22.2352 -3.3593 -0.3219 3.1224 19.5647
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 28.6834 0.3085 92.987 <2e-16 ***
sp43 -1.8202 0.3600 -5.057 5e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.244 on 1086 degrees of freedom
Multiple R-squared: 0.023, Adjusted R-squared: 0.0221
F-statistic: 25.57 on 1 and 1086 DF, p-value: 5.004e-07
Which single hypothesis best fits our data?
dats_bin <- dats_bin |>
dplyr::mutate(acc = sp04 + sp26 + sp43)
model_acc <- lm(y ~ acc, data = dats_bin)
summary(model_acc)
Call:
lm(formula = y ~ acc, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-21.771 -3.318 -0.039 3.160 20.029
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.1837 0.3376 86.433 < 2e-16 ***
acc -0.9642 0.1566 -6.158 1.04e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.215 on 1086 degrees of freedom
Multiple R-squared: 0.03373, Adjusted R-squared: 0.03285
F-statistic: 37.92 on 1 and 1086 DF, p-value: 1.039e-09
Which single hypothesis best fits our data?
dats_bin <- dats_bin |>
dplyr::mutate(rec = (sp04 * 4) + (sp26 * 26) + (sp43 * 43))
model_rec <- lm(y ~ rec, data = dats_bin)
summary(model_rec)
Call:
lm(formula = y ~ rec, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-21.7415 -3.3916 -0.2966 3.1105 20.0584
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.011119 0.352959 82.19 < 2e-16 ***
rec -0.031594 0.005983 -5.28 1.56e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.238 on 1086 degrees of freedom
Multiple R-squared: 0.02503, Adjusted R-squared: 0.02413
F-statistic: 27.88 on 1 and 1086 DF, p-value: 1.557e-07
Which single hypothesis best fits our data?
| Hypothesis | Coeff. | R2 |
|---|---|---|
| SP04 | -1.737 | 0.026 |
| SP26 | -1.075 | 0.008 |
| SP43 | -1.820 | 0.023 |
| Acc | -0.964 | 0.034 |
| Rec | -0.032 | 0.025 |
Which compound hypothesis best fits our data?
Call:
lm(formula = y ~ acc + sp04, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-21.8415 -3.2942 -0.0866 3.1362 19.9585
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.0204 0.3561 81.506 < 2e-16 ***
acc -0.7307 0.2254 -3.242 0.00122 **
sp04 -0.6626 0.4604 -1.439 0.15035
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.212 on 1085 degrees of freedom
Multiple R-squared: 0.03558, Adjusted R-squared: 0.0338
F-statistic: 20.01 on 2 and 1085 DF, p-value: 2.92e-09
Which compound hypothesis best fits our data?
Call:
lm(formula = y ~ acc + sp26, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-22.4921 -3.2827 -0.1005 3.1465 19.3079
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.0049 0.3448 84.129 < 2e-16 ***
acc -1.3891 0.2340 -5.936 3.92e-09 ***
sp26 1.3244 0.5430 2.439 0.0149 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.203 on 1085 degrees of freedom
Multiple R-squared: 0.039, Adjusted R-squared: 0.03723
F-statistic: 22.02 on 2 and 1085 DF, p-value: 4.232e-10
Which compound hypothesis best fits our data?
Call:
lm(formula = y ~ acc + sp43, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-21.9430 -3.3812 -0.1161 3.2287 19.8569
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.2274 0.3430 85.206 < 2e-16 ***
acc -0.8362 0.2357 -3.547 0.000406 ***
sp43 -0.3914 0.5389 -0.726 0.467865
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.216 on 1085 degrees of freedom
Multiple R-squared: 0.0342, Adjusted R-squared: 0.03242
F-statistic: 19.21 on 2 and 1085 DF, p-value: 6.314e-09
Which compound hypothesis best fits our data?
Call:
lm(formula = y ~ acc + rec, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-21.725 -3.353 -0.018 3.189 20.075
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.117563 0.353053 82.474 < 2e-16 ***
acc -1.179404 0.369463 -3.192 0.00145 **
rec 0.009041 0.014055 0.643 0.52019
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.216 on 1085 degrees of freedom
Multiple R-squared: 0.0341, Adjusted R-squared: 0.03232
F-statistic: 19.15 on 2 and 1085 DF, p-value: 6.682e-09
Which compound hypothesis best fits our data?
| Hypothesis | Coeff. | R2 |
|---|---|---|
| Acc + SP04 | -0.731 | 0.036 |
| Acc + SP26 | -1.389 | 0.039 |
| Acc + SP43 | -0.836 | 0.034 |
| Acc + Rec | -1.179 | 0.034 |
Which compound hypothesis best fits our data?
Call:
lm(formula = y ~ acc + sp26 + sp04, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-22.488 -3.274 -0.100 3.145 19.312
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.00252 0.35570 81.537 < 2e-16 ***
acc -1.38035 0.39973 -3.453 0.000575 ***
sp26 1.31398 0.66818 1.966 0.049496 *
sp04 -0.01521 0.56551 -0.027 0.978542
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.206 on 1084 degrees of freedom
Multiple R-squared: 0.039, Adjusted R-squared: 0.03634
F-statistic: 14.67 on 3 and 1084 DF, p-value: 2.29e-09
Which compound hypothesis best fits our data?
Call:
lm(formula = y ~ acc + sp26 + sp43, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-22.488 -3.274 -0.100 3.145 19.312
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.00252 0.35570 81.537 < 2e-16 ***
acc -1.39557 0.33635 -4.149 3.6e-05 ***
sp26 1.32920 0.57122 2.327 0.0202 *
sp43 0.01521 0.56551 0.027 0.9785
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.206 on 1084 degrees of freedom
Multiple R-squared: 0.039, Adjusted R-squared: 0.03634
F-statistic: 14.67 on 3 and 1084 DF, p-value: 2.29e-09
Which compound hypothesis best fits our data?
Call:
lm(formula = y ~ acc + sp26 + rec, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-22.488 -3.274 -0.100 3.145 19.312
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.0025241 0.3556996 81.537 < 2e-16 ***
acc -1.3971265 0.3801441 -3.675 0.000249 ***
sp26 1.3206129 0.5616493 2.351 0.018886 *
rec 0.0003901 0.0145002 0.027 0.978542
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.206 on 1084 degrees of freedom
Multiple R-squared: 0.039, Adjusted R-squared: 0.03634
F-statistic: 14.67 on 3 and 1084 DF, p-value: 2.29e-09
Which compound hypothesis best fits our data?
| Hypothesis | Coeff. | R2 |
|---|---|---|
| Acc + SP26 + SP04 | -1.380 | 0.039 |
| Acc + SP26 + SP43 | -1.396 | 0.039 |
| Acc + SP26 + Rec | -1.397 | 0.039 |
Are compound hypotheses improving our model?
| Model | Hypothesis | R2 |
|---|---|---|
| 1 | Acc | 0.034 |
| 2 | Acc + SP26 | 0.039 |
| 3 | Acc + SP26 + SP04 | 0.039 |




Call:
lm(formula = y ~ acc, data = dats_bin)
Residuals:
Min 1Q Median 3Q Max
-21.771 -3.318 -0.039 3.160 20.029
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.1837 0.3376 86.433 < 2e-16 ***
acc -0.9642 0.1566 -6.158 1.04e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.215 on 1086 degrees of freedom
Multiple R-squared: 0.03373, Adjusted R-squared: 0.03285
F-statistic: 37.92 on 1 and 1086 DF, p-value: 1.039e-09
\[5\left(1.04 \times 10^{-9} \right) = 5.19 \times 10^{-9}\]
slcma Packageslcma R package simplifies everything.
Manually
With slcma
1. Fit Models
Fit a model for each hypothesis, as well as compound hypotheses
Uses LARS, a more cautious version of forward selection
2. Compare Model Fit
Create an elbow plot
Generates an elbow plot with a single command
3. Calculate p-Values
Apply a Bonferroni correction
Uses fixed LASSO inference or max-|t| test to correct p-values
slcma package is available on GitHubinstall_github() command from the remotes packageInstall and Load
# install the package
remotes::install_github("thedunnlab/slcma")
# load the package
library(slcma)Fit All Hypotheses with LARS
slcma_model <- slcma(
y ~ sp04 + sp26 + sp43 +
Accumulation(sp04, sp26, sp43) +
Recency(weights = c(4, 26, 43), sp04, sp26, sp43),
data = dats_bin
) Term Role
(Intercept) Adjusted for in all models
sp04 Available for variable selection
sp26 Available for variable selection
sp43 Available for variable selection
Accumulation(sp04, sp26, sp43) Available for variable selection
Recency(weights = c(4, 26, 43), sp04, sp26, sp43) Available for variable selection
Summarize the Selection Path
summary(slcma_model)
Summary of LARS procedure
Step Variable selected Variable removed Variables R-squared
0 0 0.000
1 Accumulation(sp04, sp26, sp43) 1 0.022
2 sp04 2 0.029
3 sp43 3 0.039
Elbow Plot
plot(slcma_model)
Fixed LASSO Inference
slcmaInfer(slcma_model, 1, method = "slcmaFLI")
Inference for model at Step 1 of LARS procedure
Number of selected variables: 1
R-squared from lasso fit: 0.022
Results from fixed lasso inference (selective inference):
Standard deviation of noise (specified or estimated) sigma = 5.210
Testing results at lambda = 18.578, with alpha = 0.050
Coef P-value CI.lo CI.up LoTailArea
Accumulation(sp04, sp26, sp43) -0.964 0 -1.272 -0.63 0.024
UpTailArea
Accumulation(sp04, sp26, sp43) 0.024
lm(y ~ acc))slcmaInfer(slcma_model, 1, method = "relax")
Inference for model at Step 1 of LARS procedure
Number of selected variables: 1
R-squared from lasso fit: 0.022
Results from relaxed lasso:
R-squared from relaxed lasso fit: 0.034
Coef SE CI.lo CI.up
Accumulation(sp04, sp26, sp43) -0.9641575 0.1562986 -1.270497 -0.6578178
Naive Calculation
Bonferroni Correction
Fixed LASSO Inference
Max-|t| Test
Fixed LASSO Inference
selectiveInference PackageMax-|t| Test
slcma PackageSimulate Complete Data
# set seed
set.seed(1234)
# simulate covariate, hypothesis, and outcome data
n <- 5000
cov1 <- rnorm(n)
cov2 <- rbinom(n, 1, 0.3)
sp1 <- 0.5 * cov1 + rnorm(n)
sp3 <- 0.5 * sp1 + 0.5 * cov1 + rnorm(n)
sp5 <- 0.5 * sp3 + 0.5 * cov1 + rnorm(n)
sp9 <- 0.5 * sp5 + 0.5 * cov1 + rnorm(n)
y <- 0.3 * cov1 + 0.2 * cov2 +
0.02 * (1 * sp1 + 3 * sp3 + 5 * sp5 + 9 * sp9) + rnorm(n)Add Missing Values
# set 5% of each covariate and exposure to missing completely at random
cov1[sample(n, 0.05 * n)] <- NA
cov2[sample(n, 0.05 * n)] <- NA
sp1[sample(n, 0.05 * n)] <- NA
sp3[sample(n, 0.05 * n)] <- NA
sp5[sample(n, 0.05 * n)] <- NA
sp9[sample(n, 0.05 * n)] <- NA
# create data frame
dats_miss <- data.frame(cov1, cov2, sp1, sp3, sp5, sp9, y)
# clean up
rm(n, cov1, cov2, sp1, sp3, sp5, sp9, y)m complete datasetsmice package, which is installed and loaded with slcma
slcma: Pass the imputed data straight to slcma(), which pools the m datasets into one with their average means and covariancesdats_imp <- mice::mice(
dats_miss,
m = 5,
maxit = 20,
seed = 4321
)y as a predictor in the imputation modelrec and acc after imputation since they are dependent on imputed values for sensitive periodsNumber of Imputations
We use m = 5 for convenience. In practice, use at least as many imputations as the percentage of incomplete cases (26 here; White et al., 2011).
Fit All Hypotheses, Adjusting for Covariates
slcma_model <- slcma(
y ~ cov1 + cov2 + sp1 + sp3 + sp5 + sp9 +
Accumulation(sp1, sp3, sp5, sp9) +
Recency(weights = c(1, 3, 5, 9), sp1, sp3, sp5, sp9),
data = dats_imp,
adjust = c(1, 2)
) Term Role
(Intercept) Adjusted for in all models
cov1 Adjusted for in all models
cov2 Adjusted for in all models
sp1 Available for variable selection
sp3 Available for variable selection
sp5 Available for variable selection
sp9 Available for variable selection
Accumulation(sp1, sp3, sp5, sp9) Available for variable selection
Recency(weights = c(1, 3, 5, 9), sp1, sp3, sp5, sp9) Available for variable selection
Elbow Plot
plot(slcma_model)
Max-|t| Test
slcmaInfer(slcma_model, 1, method = "maxt")
Inference for model at Step 1 of LARS procedure
Number of selected variables: 1
Partial R-squared from lasso fit: 0.099
Total R-squared from lasso fit: 0.310
Adjusted for: cov1, cov2
Results from max-|t| test:
Error standard deviation: 1.017 on 4993 degrees of freedom
Coef P-value
Recency(weights = c(1, 3, 5, 9), sp1, sp3, sp5, sp9) 0.02129622 0
Message regarding calculation of P-value: Normal Completion
with estimated numeric absolute error: 0.000000e+00
Max-|t| Test with Confidence Intervals
slcmaInfer(slcma_model, 1, method = "maxt", do.maxtCI = TRUE)
Inference for model at Step 1 of LARS procedure
Number of selected variables: 1
Partial R-squared from lasso fit: 0.099
Total R-squared from lasso fit: 0.310
Adjusted for: cov1, cov2
Results from max-|t| test:
Error standard deviation: 1.017 on 4993 degrees of freedom
Confidence interval coverage 95.0 percent
Coef P-value
Recency(weights = c(1, 3, 5, 9), sp1, sp3, sp5, sp9) 0.02129622 0
CI.lo CI.up
Recency(weights = c(1, 3, 5, 9), sp1, sp3, sp5, sp9) 0.0207465 0.02349474
Message regarding calculation of P-value: Normal Completion
with estimated numeric absolute error: 0.000000e+00
Outcome Variables
Time-Varying Covariates
SLCMA is not a data mining tool
SLCMA is inseparable from theory
Choose Appropriate Hypotheses
Do Not Deviate from Structure
If you want to p-hack, don’t waste your time with SLCMA.
Foundational Article for SLCMA
Introduction to SLCMA with LARS

Please feel free to reach out with questions.
Beyond the Big 3, the slcma package includes helper functions for four more hypotheses.
| Hypothesis | Function | Exposure Type |
|---|---|---|
| Mobility | Mobility(x1, x2) |
Binary only |
| Change | Change(x1, x2) |
Mainly continuous |
| Always Exposed | Always(...) |
Binary only |
| Ever Exposed | Ever(...) |
Binary only |
\[\mathit{Mob}^{+}_{jk} = \left(1 - x_j\right)x_k \qquad \mathit{Mob}^{-}_{jk} = x_j\left(1 - x_k\right)\]
Example
| ID | Exp1 | Exp2 | Mob+12 | Mob−12 |
|---|---|---|---|---|
| 1 | 0 | 0 | \((1 - 0) \times 0 = 0\) | \(0 \times (1 - 0) = 0\) |
| 2 | 1 | 1 | \((1 - 1) \times 1 = 0\) | \(1 \times (1 - 1) = 0\) |
| 3 | 0 | 1 | \((1 - 0) \times 1 = 1\) | \(0 \times (1 - 1) = 0\) |
| 4 | 1 | 0 | \((1 - 1) \times 0 = 0\) | \(1 \times (1 - 0) = 1\) |
| 5 | 1 | 0 | \((1 - 1) \times 0 = 0\) | \(1 \times (1 - 0) = 1\) |
\[\mathit{Chng}_{jk} = x_k - x_j\]
Example
| ID | Exp1 | Exp2 | Chng12 |
|---|---|---|---|
| 1 | 0 | 0 | \(0 - 0 = 0\) |
| 2 | 1 | 1 | \(1 - 1 = 0\) |
| 3 | 0 | 1 | \(1 - 0 = 1\) |
| 4 | 1 | 0 | \(0 - 1 = -1\) |
| 5 | 1 | 0 | \(0 - 1 = -1\) |
\[\mathit{Alw} = \prod_{j=1}^m{x_j}\]
Example
| ID | Exp1 | Exp2 | Exp3 | Alw |
|---|---|---|---|---|
| 1 | 0 | 0 | 0 | \(0 \times 0 \times 0 = 0\) |
| 2 | 1 | 1 | 1 | \(1 \times 1 \times 1 = 1\) |
| 3 | 0 | 1 | 0 | \(0 \times 1 \times 0 = 0\) |
| 4 | 1 | 0 | 0 | \(1 \times 0 \times 0 = 0\) |
| 5 | 1 | 0 | 1 | \(1 \times 0 \times 1 = 0\) |
\[\mathit{Ever} = 1 - \prod_{j=1}^m{\left(1 - x_j\right)}\]
Example
| ID | Exp1 | Exp2 | Exp3 | Ever |
|---|---|---|---|---|
| 1 | 0 | 0 | 0 | \(1 - (1 \times 1 \times 1) = 0\) |
| 2 | 1 | 1 | 1 | \(1 - (0 \times 0 \times 0) = 1\) |
| 3 | 0 | 1 | 0 | \(1 - (1 \times 0 \times 1) = 1\) |
| 4 | 1 | 0 | 0 | \(1 - (0 \times 1 \times 1) = 1\) |
| 5 | 1 | 0 | 1 | \(1 - (0 \times 1 \times 0) = 1\) |
slcma() builds its model matrix from the formula, so any term R can compute from your exposures can enter as a hypothesisI(), such as I(sp04 * sp26) for exposure at both ages 4 and 26Accumulation() and Recency()
slcma package only works with continuous outcomesUse LASSO models with the glmnet package
Use “SLCMA from First Principles”
ALSPAC
Avon Longitudinal Study of Parents and Children
FFCWS
Future of Families and Child Wellbeing Study

Partial Out Covariates
Use the Frisch-Waugh-Lovell theorem:
Compare Hypotheses
Regress each hypothesis on the two depression outcomes:
The model with the largest \(R^2\) is chosen as the best-fitting hypothesis.
Regress outcomes on the best-fitting hypothesis to estimate coefficients:

| Age | ||||
|---|---|---|---|---|
| Wave | Years | Range | Mean | Exposure |
| Wave I | 1994-1995 | 12-21 | 15 | tvhrs_1 |
| Wave III | 2001-2002 | 18-26 | 22 | tvhrs_3 |
| Wave IV | 2008-2009 | 24-32 | 28 | tvhrs_4 |
| Wave V | 2016-2018 | 33-43 | 37 | tvhrs_5 |




What is my time metric?
Name it in real units, such as years since baseline or years of age
Does the spacing match the data?
Unequal intervals between waves need unequal intervals between weights
Where does the scale start?
Not at zero, since a weight of 0 drops that occasion from the score
The real test: If you can answer each question in a sentence, you can defend your weights to a reviewer.
