-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 213: Create functionality for passing in newdata
#231
Changes from all commits
bd840a8
03756cc
9317f25
ac22a65
e7e2be2
7b9a619
13e8f53
b00526b
12f05e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
prep_obs <- as_latent_individual(sim_obs) | ||
prep_obs$sex <- rbinom(n = nrow(prep_obs), size = 1, prob = 0.5) | ||
|
||
fit_sex <- epidist( | ||
data = prep_obs, | ||
formula = brms::bf(mu ~ 1 + sex, sigma ~ 1 + sex) | ||
) | ||
|
||
draws <- posterior::as_draws_df(fit_sex$fit) | ||
|
||
# With newdata = NULL | ||
pred <- predict_delay_parameters(fit_sex) | ||
|
||
# With newdata | ||
strata_df <- prep_obs[1:2, ] |> as.data.frame() | ||
|
||
strata_df <- strata_df |> | ||
dplyr::select(delay_central, sex, obs_t, pwindow_upr, swindow_upr) | ||
athowes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
pred_strata <- predict_delay_parameters(fit_sex, newdata = strata_df) | ||
|
||
# extract_all_strata <- function() { | ||
# | ||
# } | ||
|
||
library(ggplot2) | ||
ggplot(pred_strata, aes(y = mean)) + | ||
geom_histogram() + | ||
facet_grid(~ index) + | ||
coord_flip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract out LHS of equation bits from
bterms
(make not specific tolatent_individual
)