prepare_data_for_fig: Functions to prepare data for the figures

prepare_data_for_figR Documentation

Functions to prepare data for the figures

Description

These functions are used to prepare the data required to draw the figures. They allow for the computation of predictions averaged over the non focal fixed predictors.

Usage

prepare_newdata_fig_3(birth_level_data, xaxis = c("age", "parity"))

prepare_data_fig_4A(fit_PP)

prepare_data_fig_4B(fit_IBI)

prepare_data_fig_4C(fit_twin)

prepare_newdata_fig_S1()

prepare_data_fig_S1(fit_AFB, nb_boot = 1000)

prepare_data_fig_S2(fit_PP, fit_IBI, fit_twin, mother_level_data)

prepare_data_fig_S6(simulation_obj, birth_level_data)

Arguments

birth_level_data

a tibble or data.frame with birth level data (expanded or not)

xaxis

a character indicating whether "age" or "parity" must be considered as the x-axis

fit_PP

a fitted model for predicting the parity progression

fit_IBI

a fitted model for predicting the interbirth interval

fit_twin

a fitted model for predicting the per-birth probability of twinning

fit_AFB

a fitted model for predicting the age at first birth

nb_boot

the number of simulations for the parametric bootstrap used to compute the intervals

mother_level_data

a tibble or data.frame with mother level data

simulation_obj

an object produced by run_simulation

Details

We recommend you to look at the raw R code of these functions on GitHub (file '/R/plots.R') to understand how they work. We commented the code to make this clear. While you could directly look at the code of these functions while using the package, mind that the comments will have been stripped away during the installation process.

Functions

  • prepare_newdata_fig_3(): an internal function to prepare the data used to generate the predictions to be plotted in Fig. 3

  • prepare_data_fig_4A(): prepare the data to be plotted in Fig. 4A

  • prepare_data_fig_4B(): prepare the data to be plotted in Fig. 4B

  • prepare_data_fig_4C(): prepare the data to be plotted in Fig. 4C

  • prepare_newdata_fig_S1(): an internal function to prepare the data used to generate the predictions to be plotted in Fig. S1

  • prepare_data_fig_S1(): prepare the data to be plotted in Fig. S1

  • prepare_data_fig_S2(): prepare the data to be plotted in Fig. S2

  • prepare_data_fig_S6(): prepare the data to be plotted in Fig. S6

Examples

prepare_newdata_fig_3(expand_data(data_births_all), xaxis = "age")
prepare_newdata_fig_3(expand_data(data_births_all), xaxis = "parity")

# for more realistic use, see ?twinR


courtiol/twinR documentation built on July 11, 2024, 12:04 a.m.