From 773923e0da9bc18f0f4e9f2bb9347f0e8490e92d Mon Sep 17 00:00:00 2001 From: Steve Phelps Date: Sun, 21 Jan 2024 13:55:51 +0000 Subject: [PATCH] gemeans contrast for posthoc testing --- environment-frozen.yml | 4 ++++ environment.yml | 1 + jupyter-book/R-MixedModel.R | 27 +++++++++++++-------------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/environment-frozen.yml b/environment-frozen.yml index f150183..9d55ff7 100644 --- a/environment-frozen.yml +++ b/environment-frozen.yml @@ -484,6 +484,7 @@ dependencies: - r-lme4=1.1_35.1=r43ha503ecb_0 - r-lmtest=0.9_40=r43h61816a4_2 - r-loo=2.6.0=r43hc72bb7e_1 + - r-lsmeans=2.30_0=r43hc72bb7e_4 - r-lubridate=1.9.3=r43h57805ef_0 - r-magrittr=2.0.3=r43h57805ef_2 - r-maptools=1.1_8=r43h57805ef_0 @@ -505,6 +506,7 @@ dependencies: - r-modelmetrics=1.2.2.2=r43ha503ecb_3 - r-modelr=0.1.11=r43hc72bb7e_1 - r-modelsummary=1.4.3=r43hc72bb7e_0 + - r-multcomp=1.4_25=r43hc72bb7e_0 - r-munsell=0.5.0=r43hc72bb7e_1006 - r-mvtnorm=1.2_4=r43hd9ac46e_0 - r-nleqslv=3.3.5=r43h61816a4_0 @@ -580,6 +582,7 @@ dependencies: - r-rstatix=0.7.2=r43hc72bb7e_1 - r-rstudioapi=0.15.0=r43hc72bb7e_0 - r-rvest=1.0.3=r43hc72bb7e_2 + - r-sandwich=3.1_0=r43hc72bb7e_0 - r-sass=0.4.8=r43ha503ecb_0 - r-scales=1.3.0=r43hc72bb7e_0 - r-selectr=0.4_2=r43hc72bb7e_3 @@ -612,6 +615,7 @@ dependencies: - r-tensora=0.36.2.1=r43h57805ef_0 - r-texreg=1.39.3=r43hc72bb7e_0 - r-textshaping=0.3.7=r43hd87b9d6_0 + - r-th.data=1.1_2=r43hc72bb7e_1 - r-threejs=0.3.3=r43hc72bb7e_3 - r-tibble=3.2.1=r43h57805ef_2 - r-tidyr=1.3.0=r43ha503ecb_1 diff --git a/environment.yml b/environment.yml index 9b42372..2fd2d62 100644 --- a/environment.yml +++ b/environment.yml @@ -52,6 +52,7 @@ dependencies: - r-cmdstanr - r-languageserver - r-marginaleffects + - r-multcomp - pip - pip: - -e ./ diff --git a/jupyter-book/R-MixedModel.R b/jupyter-book/R-MixedModel.R index eb7e630..01f5445 100644 --- a/jupyter-book/R-MixedModel.R +++ b/jupyter-book/R-MixedModel.R @@ -58,16 +58,16 @@ use_condaenv("llm-cooperation") llm_coop <- import("llm_cooperation.main") # %% -config <- llm_coop$Configuration( - grid = dict( - temperature = list(0.1), - model = list("gpt-3.5-turbo-1106"), - max_tokens = list(500) - ), - experiment_names = list("dilemma"), - num_participant_samples = 30, - num_replications = 3 -) +# config <- llm_coop$Configuration( +# grid = dict( +# temperature = list(0.1), +# model = list("gpt-3.5-turbo-1106"), +# max_tokens = list(500) +# ), +# experiment_names = list("dilemma"), +# num_participant_samples = 30, +# num_replications = 3 +# ) # %% config <- llm_coop$Configuration( @@ -440,8 +440,7 @@ summary(model_pd_2) # %% texreg( - - model_pd_1, + model_pd_2, caption = "Fitted model for Prisoners Dilemma", label = "table:pd-estimates", file = "pd-estimates.tex", @@ -461,7 +460,7 @@ texreg( # %% pdf("figs/ranef_hist_pd.pdf") -hist(ranef(model_pd_1)$cond$Participant_id[, 1]) +hist(ranef(model_pd_2)$cond$Participant_id[, 1]) dev.off() # %% @@ -723,7 +722,7 @@ combined.plots options(repr.plot.height = 12) pdf("figs/residuals-plots.pdf") simulationOutput <- - simulateResiduals(fittedModel = model_pd_1, plot = TRUE, integerResponse = TRUE) + simulateResiduals(fittedModel = model_pd_2, plot = TRUE, integerResponse = TRUE) dev.off() # %%