Effect modification and random intercepts

40 views
Skip to first unread message

Carole Bouverat

unread,
Jul 24, 2023, 1:32:06 PM7/24/23
to lav...@googlegroups.com
Dear lavaan community,

Thank you for this group and the helpful lavaan tutorial! 
Currently, I am working on a dataset to analyze the impacts of climate change on health while working in the heat. Through lavaan, I am coding the following relationships and would be super glad if someone could help me answer my two questions:

model1 <- 
'Heat stress =~ air_temp + solar_rad + air_velocity + humidity
Heat strain =~ heart_rate + skin_temp +
tympanic_temp + core_temp
Heat strain ~ Heat stress'
fit <- sem(model1, data=data)
summary(fit, standardized=TRUE, fit.measures=TRUE)

Question 1: We have repeated measures for each of the 100 participants and would like to consider these individual differences with random intercepts. Does the lavaan software have such a feature included?

Question 2: The effect of heat stress on heat strain is modified by several variables such as age and level of fitness. Does lavaan have a feature to code effect modification or is it better to code this as a latent variable?

Many thanks in advance & best regards,
Carole Bouverat



Jeremy Miles

unread,
Jul 24, 2023, 1:56:13 PM7/24/23
to lav...@googlegroups.com
On Mon, 24 Jul 2023 at 10:32, Carole Bouverat <carole....@gmail.com> wrote:
Dear lavaan community,

Thank you for this group and the helpful lavaan tutorial! 
Currently, I am working on a dataset to analyze the impacts of climate change on health while working in the heat. Through lavaan, I am coding the following relationships and would be super glad if someone could help me answer my two questions:

model1 <- 
'Heat stress =~ air_temp + solar_rad + air_velocity + humidity
Heat strain =~ heart_rate + skin_temp +
tympanic_temp + core_temp
Heat strain ~ Heat stress'
fit <- sem(model1, data=data)
summary(fit, standardized=TRUE, fit.measures=TRUE)

Question 1: We have repeated measures for each of the 100 participants and would like to consider these individual differences with random intercepts. Does the lavaan software have such a feature included?


Yes, there are a couple of ways to do this. Which one is best depends on the specific hypotheses you want to test. Can you elaborate?
 
Question 2: The effect of heat stress on heat strain is modified by several variables such as age and level of fitness. Does lavaan have a feature to code effect modification or is it better to code this as a latent variable?


 
This is a moderator effect. Moderator effects are tricky in latent variable models, when your moderators are (as yours appear to be) there are several approaches though. The quantitude podcast covered them earlier this year: https://quantitudepod.org/s4e18-lv-interactions/

Jeremy

Carole Bouverat

unread,
Jul 24, 2023, 3:39:15 PM7/24/23
to lavaan
Hi Jeremy,

Thanks a lot for your reply and the link to the podcast. This is much appreciated.

For the question about the random intercepts, I gladly elaborate more:

- Sample size: We have 100 study participants who work in agriculture.
- Data resolution: For each participant, we have environmental measurements and health measurements in 5-minute intervals for work shifts of several hours.
- Observations: Overall we have 170'000 datapoints.
- Goal: When performing the SEM through lavaan, we would like to control for individual differences, because every individual has specific patterns in their health variables such as different mean values and different slopes of the increase when exposed to heat stress.

I hope this makes the question clearer.
With kind regards and many thanks,
Carole

Jeremy Miles

unread,
Jul 24, 2023, 7:26:04 PM7/24/23
to lav...@googlegroups.com
On Mon, 24 Jul 2023 at 12:39, Carole Bouverat <carole....@gmail.com> wrote:
Hi Jeremy,

Thanks a lot for your reply and the link to the podcast. This is much appreciated.

For the question about the random intercepts, I gladly elaborate more:

- Sample size: We have 100 study participants who work in agriculture.
- Data resolution: For each participant, we have environmental measurements and health measurements in 5-minute intervals for work shifts of several hours.


That's a lot of data, and it's rather closely space - I wonder if you will need to be concerned about autocorrelation, which is not something that lavaan handles (or didn't, last time I looked into this). 


 
- Observations: Overall we have 170'000 datapoints.
- Goal: When performing the SEM through lavaan, we would like to control for individual differences, because every individual has specific patterns in their health variables such as different mean values and different slopes of the increase when exposed to heat stress.


You can start here:


But note that you have two kinds of relationships: relationships within people (when I am hotter, I have more strain than when I am cooler) and relationships between people (when I am hotter than you, I have more strain than you).  You need to think about which of these you are interested in.

Jeremy


Carole Bouverat

unread,
Jul 25, 2023, 5:03:59 AM7/25/23
to lavaan
This is very helpful, many thanks Jeremy. 
All best wishes, 
Carole

Reply all
Reply to author
Forward
0 new messages