Read in the data:
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.4.0 ✔ purrr 0.3.4
✔ tibble 3.1.7 ✔ dplyr 1.1.0
✔ tidyr 1.2.0 ✔ stringr 1.4.0
✔ readr 2.1.4 ✔ forcats 0.5.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
Loading required package: stats4
Loading required package: splines
df <- read.csv('r-34 data downloader/output_data_.csv')
df <- df |> filter(is.na(reward) == FALSE)
head(df)
mooclet_id learner_id arm
1 588 15346 C3 Long Prompt Reminder Clinical TrialZzgot_reminder
2 588 15284 C3 Long Prompt Reminder Clinical TrialZzgot_reminder
3 587 15346 C2 Long Prompt Motivation Clinical TrialZzinspiration
4 587 15284 C2 Long Prompt Motivation Clinical TrialZzno_motivation
5 588 15283 C3 Long Prompt Reminder Clinical TrialZzgot_reminder
6 587 15283 C2 Long Prompt Motivation Clinical TrialZzno_motivation
timestamp reward reward_name
1 2023-12-30 22:00:22.204736+00:00 0 motivation_check_in
2 2023-12-30 22:00:35.502809+00:00 0 motivation_check_in
3 2023-12-30 22:00:48.283833+00:00 0 motivation_check_in
4 2023-12-30 22:01:01.103650+00:00 0 motivation_check_in
5 2023-11-04 16:30:27.194216+00:00 1 motivation_check_in
6 2023-11-04 16:30:49.964350+00:00 1 motivation_check_in
context_is_weekday context_is_preferred_time context_time_of_day_period
1 1 0 0.6666667
2 1 0 1.0000000
3 1 0 0.6666667
4 1 0 1.0000000
5 1 0 0.3333333
6 1 0 0.3333333
context_active_last_48 context_study_period context_k10_response_sum_class
1 1 1.0000000 1
2 0 1.0000000 1
3 1 1.0000000 1
4 0 1.0000000 1
5 1 0.3333333 1
6 1 0.3333333 1
Model 1: Modular bandits data are fitting on LM since the reward is multi-class,
could use multi-nomial logistic model, too
B1 model: fitted
df |>
filter(mooclet_id == 583) |>
lm(formula = reward ~ as.factor(arm) +
context_is_weekday +
context_is_preferred_time +
context_time_of_day_period +
context_active_last_48 +
context_study_period +
context_k10_response_sum_class) |>
summary()
Call:
lm(formula = reward ~ as.factor(arm) + context_is_weekday + context_is_preferred_time +
context_time_of_day_period + context_active_last_48 + context_study_period +
context_k10_response_sum_class, data = filter(df, mooclet_id ==
583))
Residuals:
Min 1Q Median 3Q Max
-0.47427 -0.28434 0.04405 0.18298 0.57266
Coefficients:
Estimate Std. Error
(Intercept) 0.319378 0.416466
as.factor(arm)B1 Modular Link Clinical TrialZzgot_no_link -0.122508 0.085525
context_is_weekday 0.017779 0.098357
context_is_preferred_time 0.174515 0.093947
context_time_of_day_period 0.005664 0.125370
context_active_last_48 -0.320568 0.205627
context_study_period 0.126482 0.263026
context_k10_response_sum_class 0.298273 0.257226
t value Pr(>|t|)
(Intercept) 0.767 0.4473
as.factor(arm)B1 Modular Link Clinical TrialZzgot_no_link -1.432 0.1591
context_is_weekday 0.181 0.8574
context_is_preferred_time 1.858 0.0699 .
context_time_of_day_period 0.045 0.9642
context_active_last_48 -1.559 0.1262
context_study_period 0.481 0.6330
context_k10_response_sum_class 1.160 0.2525
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2792 on 44 degrees of freedom
(2 observations deleted due to missingness)
Multiple R-squared: 0.2452, Adjusted R-squared: 0.1251
F-statistic: 2.042 on 7 and 44 DF, p-value: 0.07081
B2 model: fitted:
df |>
filter(mooclet_id == 584) |>
lm(formula = reward ~ as.factor(arm) +
context_is_weekday +
context_is_preferred_time +
context_time_of_day_period +
context_active_last_48 +
context_study_period +
context_k10_response_sum_class) |>
summary()
Call:
lm(formula = reward ~ as.factor(arm) + context_is_weekday + context_is_preferred_time +
context_time_of_day_period + context_active_last_48 + context_study_period +
context_k10_response_sum_class, data = filter(df, mooclet_id ==
584))
Residuals:
Min 1Q Median 3Q Max
-0.45776 -0.26859 0.05657 0.18568 0.57201
Coefficients:
Estimate
(Intercept) 0.11765
as.factor(arm)B2 Modular Rationale Clinical TrialZzmodular_rationale 0.13984
context_is_weekday 0.02042
context_is_preferred_time 0.17955
context_time_of_day_period 0.02359
context_active_last_48 -0.32726
context_study_period 0.07988
context_k10_response_sum_class 0.40216
Std. Error
(Intercept) 0.40658
as.factor(arm)B2 Modular Rationale Clinical TrialZzmodular_rationale 0.08237
context_is_weekday 0.09746
context_is_preferred_time 0.09128
context_time_of_day_period 0.12434
context_active_last_48 0.20366
context_study_period 0.26406
context_k10_response_sum_class 0.26080
t value
(Intercept) 0.289
as.factor(arm)B2 Modular Rationale Clinical TrialZzmodular_rationale 1.698
context_is_weekday 0.210
context_is_preferred_time 1.967
context_time_of_day_period 0.190
context_active_last_48 -1.607
context_study_period 0.302
context_k10_response_sum_class 1.542
Pr(>|t|)
(Intercept) 0.7737
as.factor(arm)B2 Modular Rationale Clinical TrialZzmodular_rationale 0.0966 .
context_is_weekday 0.8350
context_is_preferred_time 0.0555 .
context_time_of_day_period 0.8504
context_active_last_48 0.1152
context_study_period 0.7637
context_k10_response_sum_class 0.1302
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2767 on 44 degrees of freedom
(2 observations deleted due to missingness)
Multiple R-squared: 0.2586, Adjusted R-squared: 0.1406
F-statistic: 2.192 on 7 and 44 DF, p-value: 0.05332
For B3:
df |>
filter(mooclet_id == 585) |>
lm(formula = reward ~ as.factor(arm) +
context_is_weekday +
context_is_preferred_time +
context_time_of_day_period +
context_active_last_48 +
context_study_period +
context_k10_response_sum_class) |>
summary()
Call:
lm(formula = reward ~ as.factor(arm) + context_is_weekday + context_is_preferred_time +
context_time_of_day_period + context_active_last_48 + context_study_period +
context_k10_response_sum_class, data = filter(df, mooclet_id ==
585))
Residuals:
Min 1Q Median 3Q Max
-0.47319 -0.20807 0.02868 0.18874 0.60565
Coefficients:
Estimate
(Intercept) 0.225744
as.factor(arm)B3 Modular Interaction Clinical TrialZzreflection_question 0.108790
as.factor(arm)B3 Modular Interaction Clinical TrialZzshort_prompt 0.065037
as.factor(arm)B3 Modular Interaction Clinical TrialZzstories -0.123998
context_is_weekday -0.006637
context_is_preferred_time 0.195980
context_time_of_day_period 0.002336
context_active_last_48 -0.268577
context_study_period 0.058469
context_k10_response_sum_class 0.268362
Std. Error
(Intercept) 0.420592
as.factor(arm)B3 Modular Interaction Clinical TrialZzreflection_question 0.104955
as.factor(arm)B3 Modular Interaction Clinical TrialZzshort_prompt 0.119583
as.factor(arm)B3 Modular Interaction Clinical TrialZzstories 0.156449
context_is_weekday 0.103960
context_is_preferred_time 0.092633
context_time_of_day_period 0.128758
context_active_last_48 0.214180
context_study_period 0.273083
context_k10_response_sum_class 0.263257
t value
(Intercept) 0.537
as.factor(arm)B3 Modular Interaction Clinical TrialZzreflection_question 1.037
as.factor(arm)B3 Modular Interaction Clinical TrialZzshort_prompt 0.544
as.factor(arm)B3 Modular Interaction Clinical TrialZzstories -0.793
context_is_weekday -0.064
context_is_preferred_time 2.116
context_time_of_day_period 0.018
context_active_last_48 -1.254
context_study_period 0.214
context_k10_response_sum_class 1.019
Pr(>|t|)
(Intercept) 0.5943
as.factor(arm)B3 Modular Interaction Clinical TrialZzreflection_question 0.3059
as.factor(arm)B3 Modular Interaction Clinical TrialZzshort_prompt 0.5894
as.factor(arm)B3 Modular Interaction Clinical TrialZzstories 0.4325
context_is_weekday 0.9494
context_is_preferred_time 0.0403
context_time_of_day_period 0.9856
context_active_last_48 0.2168
context_study_period 0.8315
context_k10_response_sum_class 0.3139
(Intercept)
as.factor(arm)B3 Modular Interaction Clinical TrialZzreflection_question
as.factor(arm)B3 Modular Interaction Clinical TrialZzshort_prompt
as.factor(arm)B3 Modular Interaction Clinical TrialZzstories
context_is_weekday
context_is_preferred_time *
context_time_of_day_period
context_active_last_48
context_study_period
context_k10_response_sum_class
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2824 on 42 degrees of freedom
Multiple R-squared: 0.2628, Adjusted R-squared: 0.1048
F-statistic: 1.664 on 9 and 42 DF, p-value: 0.1287
For C1:
df |>
filter(mooclet_id == 586) |>
glm(formula = as.factor(reward) ~ as.factor(arm)+
context_is_weekday +
context_is_preferred_time +
context_time_of_day_period +
context_active_last_48 +
context_study_period +
context_k10_response_sum_class, family = binomial) |>
summary()
Call:
glm(formula = as.factor(reward) ~ as.factor(arm) + context_is_weekday +
context_is_preferred_time + context_time_of_day_period +
context_active_last_48 + context_study_period + context_k10_response_sum_class,
family = binomial, data = filter(df, mooclet_id == 586))
Deviance Residuals:
Min 1Q Median 3Q Max
-2.2677 -0.5839 -0.2669 -0.1137 2.5896
Coefficients:
Estimate
(Intercept) 1.8267
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzis_loss 0.2618
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzno_rationale 0.6589
context_is_weekday 0.8798
context_is_preferred_time 0.6899
context_time_of_day_period 0.7504
context_active_last_48 1.7211
context_study_period -2.8444
context_k10_response_sum_class -5.0329
Std. Error
(Intercept) 1.5640
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzis_loss 0.4545
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzno_rationale 0.6404
context_is_weekday 0.7304
context_is_preferred_time 0.5103
context_time_of_day_period 0.8004
context_active_last_48 0.8372
context_study_period 0.7004
context_k10_response_sum_class 0.9254
z value
(Intercept) 1.168
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzis_loss 0.576
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzno_rationale 1.029
context_is_weekday 1.205
context_is_preferred_time 1.352
context_time_of_day_period 0.938
context_active_last_48 2.056
context_study_period -4.061
context_k10_response_sum_class -5.439
Pr(>|z|)
(Intercept) 0.2428
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzis_loss 0.5646
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzno_rationale 0.3036
context_is_weekday 0.2283
context_is_preferred_time 0.1764
context_time_of_day_period 0.3485
context_active_last_48 0.0398
context_study_period 4.88e-05
context_k10_response_sum_class 5.37e-08
(Intercept)
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzis_loss
as.factor(arm)C1 Long Prompt Rationale Clinical TrialZzno_rationale
context_is_weekday
context_is_preferred_time
context_time_of_day_period
context_active_last_48 *
context_study_period ***
context_k10_response_sum_class ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 291.61 on 286 degrees of freedom
Residual deviance: 196.23 on 278 degrees of freedom
(13 observations deleted due to missingness)
AIC: 214.23
Number of Fisher Scoring iterations: 6
For C2:
df |>
filter(mooclet_id == 587) |>
glm(formula = as.factor(reward) ~ as.factor(arm)+
context_is_weekday +
context_is_preferred_time +
context_time_of_day_period +
context_active_last_48 +
context_study_period +
context_k10_response_sum_class, family = binomial) |>
summary()
Call:
glm(formula = as.factor(reward) ~ as.factor(arm) + context_is_weekday +
context_is_preferred_time + context_time_of_day_period +
context_active_last_48 + context_study_period + context_k10_response_sum_class,
family = binomial, data = filter(df, mooclet_id == 587))
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8473 -0.8158 -0.3925 0.9160 2.5667
Coefficients:
Estimate
(Intercept) -3.62122
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzinspiration 0.06774
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzno_motivation 0.98172
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzperspective 0.84936
context_is_weekday -1.00573
context_is_preferred_time 0.28865
context_time_of_day_period 0.65995
context_active_last_48 2.27761
context_study_period -2.30010
context_k10_response_sum_class 2.41450
Std. Error
(Intercept) 1.07554
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzinspiration 0.52649
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzno_motivation 0.43688
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzperspective 0.40859
context_is_weekday 0.47635
context_is_preferred_time 0.32927
context_time_of_day_period 0.97669
context_active_last_48 0.47413
context_study_period 0.53564
context_k10_response_sum_class 0.81208
z value
(Intercept) -3.367
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzinspiration 0.129
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzno_motivation 2.247
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzperspective 2.079
context_is_weekday -2.111
context_is_preferred_time 0.877
context_time_of_day_period 0.676
context_active_last_48 4.804
context_study_period -4.294
context_k10_response_sum_class 2.973
Pr(>|z|)
(Intercept) 0.00076
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzinspiration 0.89762
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzno_motivation 0.02463
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzperspective 0.03764
context_is_weekday 0.03475
context_is_preferred_time 0.38069
context_time_of_day_period 0.49923
context_active_last_48 1.56e-06
context_study_period 1.75e-05
context_k10_response_sum_class 0.00295
(Intercept) ***
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzinspiration
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzno_motivation *
as.factor(arm)C2 Long Prompt Motivation Clinical TrialZzperspective *
context_is_weekday *
context_is_preferred_time
context_time_of_day_period
context_active_last_48 ***
context_study_period ***
context_k10_response_sum_class **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 390.89 on 299 degrees of freedom
Residual deviance: 304.80 on 290 degrees of freedom
(14 observations deleted due to missingness)
AIC: 324.8
Number of Fisher Scoring iterations: 5
For C3:
df |>
filter(mooclet_id == 588) |>
glm(formula = as.factor(reward) ~ as.factor(arm)+
context_is_weekday +
context_is_preferred_time +
context_time_of_day_period +
context_active_last_48 +
context_study_period +
context_k10_response_sum_class, family = binomial) |>
summary()
Call:
glm(formula = as.factor(reward) ~ as.factor(arm) + context_is_weekday +
context_is_preferred_time + context_time_of_day_period +
context_active_last_48 + context_study_period + context_k10_response_sum_class,
family = binomial, data = filter(df, mooclet_id == 588))
Deviance Residuals:
Min 1Q Median 3Q Max
-1.7196 -0.7457 -0.2652 0.8876 2.5127
Coefficients:
Estimate
(Intercept) -3.5071
as.factor(arm)C3 Long Prompt Reminder Clinical TrialZzno_reminder -0.2138
context_is_weekday -0.7922
context_is_preferred_time 0.2780
context_time_of_day_period 0.2165
context_active_last_48 2.8292
context_study_period -2.1691
context_k10_response_sum_class 2.3428
Std. Error
(Intercept) 1.0705
as.factor(arm)C3 Long Prompt Reminder Clinical TrialZzno_reminder 0.3527
context_is_weekday 0.5407
context_is_preferred_time 0.3213
context_time_of_day_period 1.1616
context_active_last_48 0.4641
context_study_period 0.5233
context_k10_response_sum_class 0.8207
z value
(Intercept) -3.276
as.factor(arm)C3 Long Prompt Reminder Clinical TrialZzno_reminder -0.606
context_is_weekday -1.465
context_is_preferred_time 0.865
context_time_of_day_period 0.186
context_active_last_48 6.096
context_study_period -4.145
context_k10_response_sum_class 2.855
Pr(>|z|)
(Intercept) 0.00105 **
as.factor(arm)C3 Long Prompt Reminder Clinical TrialZzno_reminder 0.54447
context_is_weekday 0.14287
context_is_preferred_time 0.38685
context_time_of_day_period 0.85212
context_active_last_48 1.09e-09 ***
context_study_period 3.40e-05 ***
context_k10_response_sum_class 0.00431 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 431.83 on 348 degrees of freedom
Residual deviance: 320.50 on 341 degrees of freedom
(12 observations deleted due to missingness)
AIC: 336.5
Number of Fisher Scoring iterations: 5
For C4:
df |>
filter(mooclet_id == 590) |>
glm(formula = as.factor(reward) ~ as.factor(arm)+
context_is_weekday +
context_is_preferred_time +
context_time_of_day_period +
context_active_last_48 +
context_study_period +
context_k10_response_sum_class, family = binomial) |>
summary()
Call:
glm(formula = as.factor(reward) ~ as.factor(arm) + context_is_weekday +
context_is_preferred_time + context_time_of_day_period +
context_active_last_48 + context_study_period + context_k10_response_sum_class,
family = binomial, data = filter(df, mooclet_id == 590))
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8794 -0.8477 -0.3031 0.8981 2.6689
Coefficients:
Estimate
(Intercept) -2.0653
as.factor(arm)C4 Long Prompt Reflection Commitment Clinical TrialZzno_commitment 0.6174
context_is_weekday -0.1727
context_is_preferred_time -2.1747
context_time_of_day_period 0.3884
context_active_last_48 2.5783
context_study_period -2.6369
context_k10_response_sum_class 0.9387
Std. Error
(Intercept) 1.1079
as.factor(arm)C4 Long Prompt Reflection Commitment Clinical TrialZzno_commitment 0.2954
context_is_weekday 0.4656
context_is_preferred_time 0.5657
context_time_of_day_period 0.4653
context_active_last_48 0.5606
context_study_period 0.5678
context_k10_response_sum_class 0.8479
z value
(Intercept) -1.864
as.factor(arm)C4 Long Prompt Reflection Commitment Clinical TrialZzno_commitment 2.090
context_is_weekday -0.371
context_is_preferred_time -3.845
context_time_of_day_period 0.835
context_active_last_48 4.599
context_study_period -4.644
context_k10_response_sum_class 1.107
Pr(>|z|)
(Intercept) 0.062303
as.factor(arm)C4 Long Prompt Reflection Commitment Clinical TrialZzno_commitment 0.036584
context_is_weekday 0.710657
context_is_preferred_time 0.000121
context_time_of_day_period 0.403879
context_active_last_48 4.24e-06
context_study_period 3.41e-06
context_k10_response_sum_class 0.268281
(Intercept) .
as.factor(arm)C4 Long Prompt Reflection Commitment Clinical TrialZzno_commitment *
context_is_weekday
context_is_preferred_time ***
context_time_of_day_period
context_active_last_48 ***
context_study_period ***
context_k10_response_sum_class
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 390.00 on 298 degrees of freedom
Residual deviance: 288.59 on 291 degrees of freedom
(13 observations deleted due to missingness)
AIC: 304.59
Number of Fisher Scoring iterations: 5