Skip to content

Commit

Permalink
move integer normalisation to where data is obtained
Browse files Browse the repository at this point in the history
  • Loading branch information
phelps-sg committed Jan 22, 2024
1 parent 50a0ba2 commit 25f109c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions jupyter-book/R-MixedModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ llm_coop <- import("llm_cooperation.main")
# %%
config <- llm_coop$Configuration(
grid = dict(
temperature = list(0.1),
temperature = c(0.1, 0.6),
model = c("gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106"),
max_tokens = list(500)
),
Expand Down Expand Up @@ -261,15 +261,13 @@ result <- sapply(all_vars, function(x) lapply(all_vars, function(i) interaction_

# %%
results_pd <- results_clean[results_clean$Experiment == "dilemma", ]

results_pd$Num_cooperates <- round(results_pd$Cooperation_frequency * 6)
head(results_pd)

# %%
results_dictator <- results_clean[results_clean$Experiment == "dictator", ]
head(results_dictator)

# %%
results_pd$Num_cooperates <- round(results_pd$Cooperation_frequency * 6)

# %%
num_defects <- 6 - results_pd$Num_cooperates
summary(num_defects)
Expand Down Expand Up @@ -439,13 +437,25 @@ model_pd_2 <- glmmTMB(
# %%
model_pd_3 <- glmmTMB(
cbind(Num_cooperates, 6 - Num_cooperates) ~
Temperature +
Participant_group * Partner_condition * Model +
(1 | Participant_id),
data = results_pd,
family = betabinomial
)

# %%
model_pd_4 <- glmmTMB(
cbind(Num_cooperates, 6 - Num_cooperates) ~
Participant_group * Partner_condition * Model +
(1 | Participant_id) +
(0 + Partner_condition * Partner_condition * Model | Participant_id),
data = results_pd,
family = betabinomial,
control = glmmTMBControl(
optimizer = optim,
optCtrl = list(method = "BFGS")
)
)

# %%
summary(model_pd_2)
Expand Down

0 comments on commit 25f109c

Please sign in to comment.