-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlongitudinal_analysis_printout.Rmd
69 lines (63 loc) · 2.94 KB
/
longitudinal_analysis_printout.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: "Longitudinal Analysis"
author:
- "Francesco Beghini, Jackson Pullman, Marcus Alexander, Shivkumar Vishnempet Shridhar,"
- "Drew Prinster, Adarsh Singh, Rigoberto Matute Juárez,"
- "Edoardo M. Airoldi, Ilana L. Brito, Nicholas A. Christakis"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE)
library(lmerTest)
```
```{r, echo=FALSE}
sharing_rate_only_followup <- readRDS('sharing_rate_only_followup.Rds')
sharing_rate_only_followup$village_code_ego <- as.factor(sharing_rate_only_followup$village_code_ego)
sharing_rate_only_followup$T2 <- scale(sharing_rate_only_followup$T2)
sharing_rate_only_followup$T1 <- scale(sharing_rate_only_followup$T1)
sharing_rate_only_followup$maha_dist <- scale(sharing_rate_only_followup$maha_dist)
xcov <- readRDS('xcov.RDS')
```
<!--
```{r, echo=FALSE}
lmer_zero_model <- lmer(T2 ~ T1 + relationship + (1|village_code_ego) + (1|ego),
sharing_rate_only_followup)
summary(lmer_zero_model)
```
\newpage
-->
# First regression model
## Model the strain-sharing rate at timepoint 2 using the Mahalanobis distance as covariate
```{r}
lmer_first_model <- lmer(T2 ~ T1 + relationship + maha_dist + (1|village_code_ego) + (1|ego),
sharing_rate_only_followup)
summary(lmer_first_model)
```
\newpage
## Model the strain-sharing rate at timepoint 2 using the separate sociodemographic variables
```{r, echo=FALSE}
lmer_first_model_expanded <- lmer(T2 ~ T1 + relationship +
gender.mm + gender.ff +
indigenous.both + indigenous.one +
age_difference_abs + average_age +
DDS_average + DDS_difference_abs +
education_difference_abs + average_education +
religion_same + building_same +
wealth_difference_abs + average_wealth +
average_bristol + different_bristol +
watersource_same + same_usage_painkillers +
same_usage_antibiotics +
same_usage_antidiarrheal +
same_usage_antiparasite +
same_usage_vitamins +
same_usage_zinc +
same_usage_antifungal + (1|village_code_ego) + (1|ego), data = sharing_rate_only_followup)
summary(lmer_first_model_expanded)
```
\newpage
# Second regression model
# Model each species sharing status at timepoint 2 using the Mahalanobis distance as covariate
```{r}
lmer_species_rand <- glmer(data = xcov, T2_t ~ T1_t + relationship + maha_dist + (1|species) + (1|village_code_ego) + (1|ego), family = binomial, nAGQ=0)
summary(lmer_species_rand)
```