Skip to content

Commit

Permalink
fixed predictions_by_group
Browse files Browse the repository at this point in the history
  • Loading branch information
phelps-sg committed Jan 10, 2024
1 parent 064057c commit 524e10b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions jupyter-book/R-MixedModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@
# %%
xtable(coef(summary(model_pd))$cond, digits = 3)

# %%
predictions_by_group <- function(model) {
# %%
ggpredict(model, c("Participant_group", "Model")) %>%
predictions_by_group <- function(model) {
rename_at("group", ~"Model")
}

Expand Down Expand Up @@ -448,7 +448,7 @@

# %%
predictions_plot <- function(predictions, title) {
ggplot(predictions) +
gg plot(predictions) +
aes(x = x, y = predicted, group = Model) +
geom_errorbar(aes(ymin = conf.low, ymax = conf.high), width = .1, position = position_dodge(0.06)) +
geom_line(aes(color = Model), size = 1) + # scale_y_continuous(limits = c(0, 1)) +
Expand Down Expand Up @@ -490,14 +490,12 @@
xtable(weighted_dictator, digits = 3)

# %%
pd_actual_and_theoretical(weighted_dictator, h = hypothesized_dictator)
predictions_dictator <- pd_actual_and_theoretical(weighted_dictator, h = hypothesized_dictator)
predictions_dictator

# %%
dictator_predictions_plot <-
predictions_plot(
pd_actual_and_theoretical(weighted_dictator),
"Dictator Game"
)
dictator_predictions_plot <-
predictions_plot(predictions_dictator, "Dictator Game")
dictator_predictions_plot

# %%
Expand Down

0 comments on commit 524e10b

Please sign in to comment.