You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fit_ipw<-function(.split, ...) {
# get bootstrapped data frame.df<- as.data.frame(.split)
# fit propensity score modelpropensity_model<- glm(
park_extra_magic_morning~park_ticket_season+park_close+park_temperature_high,
data=seven_dwarfs_9, ### should this be .df?family= binomial()
)
# calculate inverse probability weights.df<-propensity_model|>
augment(type.predict="response", data=.df) |>### newdata = .df (or omit if using .df above)
mutate(wts= wt_att(
.fitted,
park_extra_magic_morning,
exposure_type="binary"
))
# fit correctly bootstrapped ipw model
lm(
wait_minutes_posted_avg~park_extra_magic_morning,
data=.df,
weights=wts
) |>
tidy()
}
Should the propensity scores be recalculated from each bootstrap sample (currently: data = seven_dwarfs_9)? [If it were done as here, it would be better to compute it once rather than once per resample.]
The text was updated successfully, but these errors were encountered:
In https://causal-inference-in-r.netlify.app/chapters/11-outcome-model#the-bootstrap, there is the following example:
Should the propensity scores be recalculated from each bootstrap sample (currently:
data = seven_dwarfs_9
)? [If it were done as here, it would be better to compute it once rather than once per resample.]The text was updated successfully, but these errors were encountered: