-
Notifications
You must be signed in to change notification settings - Fork 2
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
Allow prediction to predict for ages <1 or other regular times #75
Labels
Milestone
Comments
Assigning to @MikeLydeamore |
It seems that this now works? It is unclear what the issue to me was: library(conmat)
polymod_setting_models$home
#>
#> Call: mgcv::bam(formula = formula, family = stats::poisson, data = .,
#> offset = log(participants))
#>
#> Coefficients:
#> (Intercept) school_probability work_probability
#> 6.493e-01 -1.442e-01 1.481e-01
#> s(gam_age_offdiag).1 s(gam_age_offdiag).2 s(gam_age_offdiag).3
#> -7.637e+01 3.727e+00 1.333e+01
#> s(gam_age_offdiag).4 s(gam_age_offdiag).5 s(gam_age_offdiag).6
#> 1.264e+00 4.240e+00 1.775e+00
#> s(gam_age_offdiag).7 s(gam_age_offdiag).8 s(gam_age_offdiag).9
#> -1.031e+00 1.662e-01 0.000e+00
#> s(gam_age_offdiag_2).1 s(gam_age_offdiag_2).2 s(gam_age_offdiag_2).3
#> -3.461e-04 -1.245e-05 3.558e-05
#> s(gam_age_offdiag_2).4 s(gam_age_offdiag_2).5 s(gam_age_offdiag_2).6
#> 7.667e-06 1.673e-05 -1.517e-05
#> s(gam_age_offdiag_2).7 s(gam_age_offdiag_2).8 s(gam_age_offdiag_2).9
#> -1.454e-05 -1.592e-05 -3.658e+01
#> s(gam_age_diag_prod).1 s(gam_age_diag_prod).2 s(gam_age_diag_prod).3
#> 1.732e+00 -2.292e-01 6.706e-01
#> s(gam_age_diag_prod).4 s(gam_age_diag_prod).5 s(gam_age_diag_prod).6
#> 1.252e-01 1.412e-01 1.773e-01
#> s(gam_age_diag_prod).7 s(gam_age_diag_prod).8 s(gam_age_diag_prod).9
#> -3.042e-01 1.141e-01 7.966e-01
#> s(gam_age_diag_sum).1 s(gam_age_diag_sum).2 s(gam_age_diag_sum).3
#> -6.203e-01 -2.365e-01 3.936e-01
#> s(gam_age_diag_sum).4 s(gam_age_diag_sum).5 s(gam_age_diag_sum).6
#> -1.735e-01 2.407e-02 -1.014e-02
#> s(gam_age_diag_sum).7 s(gam_age_diag_sum).8 s(gam_age_diag_sum).9
#> 3.443e-03 7.260e-02 0.000e+00
#> s(gam_age_pmax).1 s(gam_age_pmax).2 s(gam_age_pmax).3
#> 5.904e+00 -4.460e-01 -1.303e+00
#> s(gam_age_pmax).4 s(gam_age_pmax).5 s(gam_age_pmax).6
#> -2.804e-01 -8.263e-01 -4.846e-01
#> s(gam_age_pmax).7 s(gam_age_pmax).8 s(gam_age_pmax).9
#> 5.319e-01 3.135e-01 4.053e+01
#> s(gam_age_pmin).1 s(gam_age_pmin).2 s(gam_age_pmin).3
#> -5.091e-02 2.375e-02 -2.782e-02
#> s(gam_age_pmin).4 s(gam_age_pmin).5 s(gam_age_pmin).6
#> -2.755e-02 -1.336e-02 3.870e-02
#> s(gam_age_pmin).7 s(gam_age_pmin).8 s(gam_age_pmin).9
#> 2.465e-02 -5.669e-03 -3.865e+01
#>
#> Degrees of Freedom: 8787 Total (i.e. Null); 8754.398 Residual
#> Null Deviance: 44000
#> Residual Deviance: 10280 AIC: 26970
fairfield_abs_data <- abs_age_lga("Fairfield (C)")
fairfield_abs_data
#> # A tibble: 18 × 4 (conmat_population)
#> - age: lower.age.limit
#> - population: population
#> lga lower.age.limit year population
#> <chr> <dbl> <dbl> <dbl>
#> 1 Fairfield (C) 0 2020 12261
#> 2 Fairfield (C) 5 2020 13093
#> 3 Fairfield (C) 10 2020 13602
#> 4 Fairfield (C) 15 2020 14323
#> 5 Fairfield (C) 20 2020 15932
#> 6 Fairfield (C) 25 2020 16190
#> 7 Fairfield (C) 30 2020 14134
#> 8 Fairfield (C) 35 2020 13034
#> 9 Fairfield (C) 40 2020 12217
#> 10 Fairfield (C) 45 2020 13449
#> 11 Fairfield (C) 50 2020 13419
#> 12 Fairfield (C) 55 2020 13652
#> 13 Fairfield (C) 60 2020 12907
#> 14 Fairfield (C) 65 2020 10541
#> 15 Fairfield (C) 70 2020 8227
#> 16 Fairfield (C) 75 2020 5598
#> 17 Fairfield (C) 80 2020 4006
#> 18 Fairfield (C) 85 2020 4240
# We can predict the contact rate for Fairfield from the existing contact
# data, say, between the age groups of 0-15 in 5 year bins for school:
fairfield_contacts_0_5_quarterly <- predict_setting_contacts(
contact_model = polymod_setting_models,
population = fairfield_abs_data,
# three monthly - quarterly
age_breaks = seq(from = 0, to = 5, length.out = 5*4)
)
autoplot(fairfield_contacts_0_5_quarterly) Created on 2025-01-15 with reprex v2.1.1
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://idem-lab.github.io/conmat/reference/predict_contacts.html
The text was updated successfully, but these errors were encountered: