XX

Author

Judy Zhu

library(brms) 
Warning: package 'brms' was built under R version 4.4.1
Loading required package: Rcpp
Loading 'brms' package (version 2.21.0). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').

Attaching package: 'brms'
The following object is masked from 'package:stats':

    ar
library(tidybayes)
Warning: package 'tidybayes' was built under R version 4.4.1

Attaching package: 'tidybayes'
The following objects are masked from 'package:brms':

    dstudent_t, pstudent_t, qstudent_t, rstudent_t
library(gtsummary)
Warning: package 'gtsummary' was built under R version 4.4.1

#| label: model #| cache: true fit_xx <- nobs(fit_sex)


#| label: plot
add_epred_draws(newdata = ndata)

fit_all |>add_epred_draws(newdata = newobs) |> ggplot(aes(.epred, fill = sex)) + geom_histogram(aes(y = after_stat(count/sum(count))), alpha = 0.5, bins = 100, position = “identity”) + labs(title = “Prosterior for Expected Years Lived Post-Election”, subtitle = “Male candidates live longer”, x = “Years”, y = “Probability”) + scale_x_continuous(labels = scales::number_format(accuracy = 1)) + scale_y_continuous(labels = scales::precent_format(accuracy = 1)) \[lived\_after_i = \beta_0 + \beta_1 male_i + \epsilon_i\]

Made github repo tutorial 9, connected to R. Studied data about the canidates, might not hold validity. We are seeing if being governer affects lifespan. The data and the population might not uphold representitivness. Used Fit regression. Made graph explaining that male canidates live longer.