View source: R/summarize_growth_model_ls.R
summarize_growth_model_ls | R Documentation |
This function is used within the summarize_growth_model
function to create a list object of data frames based on a user's input
data frame and output least-squares growth model object
from growth_curve_model_fit
.
The list object (referred to in this package as 'growth_model_summary_list')
can be used to extract model predicted values, residuals,
and can be inputted into supporting functions from GrowthCurveME to
generate plots and perform model diagnostics.
summarize_growth_model_ls(
data_frame,
ls_model,
function_type = "exponential",
time_unit = "hours"
)
data_frame |
A data frame object that at minimum contains three variables:
|
ls_model |
The least-squares model object that is created using
the |
function_type |
A character string specifying the function for modeling the shape of the growth. Options include "exponential", "linear", "logistic", or "gompertz". |
time_unit |
A character string specifying the units in which time is measured in. Defaults to "hours" |
A list object with the following data frames within the list:
model_summary_wide - a data frame with 1 row containing key model estimates, doubling-time, and model metrics depending on the model_type and function_type specified
model_summary_long - a data frame that is a long dataset version of
'model_summary_wide' that can be used to generate a table of the model
results (see function growth_model_summary_table
)
model_residual_data - a data frame containing the original data
frame values as well as predicted values, residuals, and theoretical
quantiles of the residuals depending on the model_type selected
(see functions growth_model_residual_plots
and
growth_vs_time_plot
)
model_sim_pred_data - a data frame with estimates and 95% prediction
intervals (not to be confused with the 95% confidence intervals calculated
from the model estimates), for mixed-effects models, values are calculated
as the median estimate and the 2.5th and 97.5th percentiles of the
simulated data from the saemix model at each time point (see
compute.sres
and plot
with
plot.type = "vpc"). For least-squares models, prediction intervals are
calculated through Taylor-series approximations using the
predFit
function.
growth_curve_model_fit
summarize_growth_model
# Load example data (exponential data)
data(exp_mixed_data)
# Fit an mixed-effects growth model to the data
exp_ls_model <- growth_curve_model_fit(
data_frame = exp_mixed_data,
function_type = "exponential",
model_type = "least-squares",
return_summary = FALSE)
# Summarize the data by creating a summary list object
exp_ls_model_summary <- summarize_growth_model_ls(
data_frame = exp_mixed_data,
ls_model = exp_ls_model,
function_type = "exponential",
time_unit = "hours")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.