Title: | Growth Parameter Estimation Method |
---|---|
Description: | Provides functions for simulating and estimating parameters of various growth models, including Logistic, Exponential, Theta-logistic, Von-Bertalanffy, and Gompertz models. The package supports both simulated and real data analysis, including parameter estimation, visualization, and calculation of global and local estimates. The methods are based on research described by Md Aktar Ul Karim and Amiya Ranjan Bhowmick (2022) in (<https://www.researchsquare.com/article/rs-2363586/v1>). An interactive web application is also available at [GPEMR Web App](<https://gpem-r.shinyapps.io/GPEM-R/>). |
Authors: | Ruqaiya Shaikh [aut, cre], Amiya Ranjan Bhowmick [aut], Md Aktar Ul Karim [aut] |
Maintainer: | Ruqaiya Shaikh <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-03-04 04:47:56 UTC |
Source: | https://github.com/cran/GPEMR |
This function generates a comparison plot of p-values obtained from different growth models (Logistic, Von-Bertalanffy, and Gompertz) using real data. It visualizes how p-values vary across time points for the specified models and provides a horizontal reference line for significance.
comparison_plot( data_path, window_size = 3, parameter, p_val_method, repetition )
comparison_plot( data_path, window_size = 3, parameter, p_val_method, repetition )
data_path |
A character string specifying the path to the data file. The file should contain the necessary data for p-value calculations. |
window_size |
An integer specifying the size of the moving window for calculations. Default is 3. |
parameter |
A list of parameters used in p-value calculation. |
p_val_method |
A character string specifying the method for p-value calculation. The options are Parametric and Non - Parametric methods. |
repetition |
An integer specifying the number of repetitions for calculations. |
A plot comparing p-values across the Logistic, Von-Bertalanffy, and Gompertz models over time points. The plot includes lines for each model's p-values, a legend, and a reference line of tolerance = 0.05.
data_path <- system.file("extdata", "sample_data.csv", package = "GPEMR") params <- list(log_r = 0.7,von_r = 0.3,c=0.2,b=0.1) comparison_plot(data_path = data_path, window_size = 5, parameter = params, p_val_method = "Parametric", repetition = 2)
data_path <- system.file("extdata", "sample_data.csv", package = "GPEMR") params <- list(log_r = 0.7,von_r = 0.3,c=0.2,b=0.1) comparison_plot(data_path = data_path, window_size = 5, parameter = params, p_val_method = "Parametric", repetition = 2)
P value calculation function for models used in comparison_plot() function
p_value_calc( data_path, window_size = 3, model, parameter, p_val_method, repetition )
p_value_calc( data_path, window_size = 3, model, parameter, p_val_method, repetition )
data_path |
The path to the data file. |
window_size |
The size of the window for analysis. |
model |
The model to be used for p-value calculation. |
parameter |
The parameters for the model. |
p_val_method |
The method to be used for p-value calculation ("Parametric" or "Non-Parametric"). |
repetition |
The number of repetitions for the analysis. |
A list containing the calculated p-values and other related information.
This function performs parameter estimation for specified models (Logistic, Von-Bertalanffy, or Gompertz) using real data from a TXT or PDF file. It calculates global and local estimates of the model parameters, including their covariance matrices, and optionally generates plots of the estimates and p-values.
real_data( data_path, window_size, model, parameter, cov = FALSE, Plot_est = FALSE, p_value_plot = FALSE, tolerance = 0.05 )
real_data( data_path, window_size, model, parameter, cov = FALSE, Plot_est = FALSE, p_value_plot = FALSE, tolerance = 0.05 )
data_path |
A character string specifying the path to the data file. Supported file types are TXT and CSV. |
window_size |
An integer specifying the size of the moving window for localized estimation. Default is 3. |
model |
A character string specifying the model to fit. Options are "Logistic", "Von-Bertalanffy", and "Gompertz". |
parameter |
A list containing initial parameter estimates. For "Logistic" and "Von-Bertalanffy" models, the list should include |
cov |
A logical value indicating whether to return the covariance matrices. Default is FALSE. |
Plot_est |
A logical value indicating whether to generate plots of the estimated parameters. Default is FALSE. |
p_value_plot |
A logical value indicating whether to generate plots of p-values for local estimates. Default is FALSE. |
tolerance |
A numeric value specifying the alpha level for p-value calculation. Default is 0.05. |
A list containing:
est_global |
A vector of global parameter estimates. |
cov_global |
A matrix of global covariance estimates (if |
est_local |
A matrix of local parameter estimates. |
cov_local |
A list of local covariance matrices (if |
est_plot |
A plot of the estimated parameters (if |
p_value_plot |
A plot of p-values for local estimates (if |
data_csv <- system.file("extdata", "sample_data.csv", package = "GPEMR") results_logistic <- real_data(data_csv, window_size = 5, model = "Logistic", parameter = list(r= 0.7), cov = TRUE, Plot_est = TRUE)
data_csv <- system.file("extdata", "sample_data.csv", package = "GPEMR") results_logistic <- real_data(data_csv, window_size = 5, model = "Logistic", parameter = list(r= 0.7), cov = TRUE, Plot_est = TRUE)
This function simulates data for independent trajectories based on specified growth models and estimates the model parameters. The simulation can be performed for several models, including Logistic, Exponential, Theta-logistic, Von Bertalanffy, and Gompertz. It also allows for calculation of global and local parameter estimates using the negative log-likelihood function.
simulated_function( time_points = 1:10, n = 10, window_size = 3, model, parameter, sigma2 = 2, rho = 0.5, x_0 = 10, cov = FALSE, Plot_est = FALSE )
simulated_function( time_points = 1:10, n = 10, window_size = 3, model, parameter, sigma2 = 2, rho = 0.5, x_0 = 10, cov = FALSE, Plot_est = FALSE )
time_points |
A numeric vector representing the time points for which the data should be simulated. |
n |
An integer specifying the number of independent trajectories to simulate. |
window_size |
An integer specifying the window size for local estimation. |
model |
A character string specifying the growth model to use. Options include 'Logistic', 'Exponential', 'Theta-logistic', 'Von-bertalanffy', and 'Gompertz'. |
parameter |
A list of model-specific parameters required for the mean function. |
sigma2 |
A numeric value for the variance of the process. |
rho |
A numeric value for the correlation coefficient. |
x_0 |
A numeric value for the initial state. |
cov |
A logical value indicating whether to print the covariance matrix. Default is FALSE. |
Plot_est |
A logical value indicating whether to plot the parameter estimates. Default is FALSE. |
The function first checks if the parameters are provided as a list. It then calculates the mean function based on the specified model and forms the covariance matrix. Multivariate normal data for the specified number of trajectories is generated using the mvtnorm::rmvnorm function. The negative log-likelihood function is defined and minimized using the optim function to estimate global parameters. Local parameter estimation is performed using a sliding window approach.
The available models are:
Logistic: Requires parameters r (growth rate) and K (carrying capacity).
Exponential: Requires parameter r (growth rate).
Theta-logistic: Requires parameters r (growth rate), theta, and K (carrying capacity).
Von-bertalanffy: Requires parameters r (growth rate) and K (asymptotic size).
Gompertz: Requires parameters b and c.
A list containing the simulated data, global parameter estimates, global covariance matrix, local parameter estimates, and optionally local covariance matrices.
res <- simulated_function( model = 'Logistic', parameter = list(r = 0.2, K = 100), cov = TRUE, Plot_est = TRUE)
res <- simulated_function( model = 'Logistic', parameter = list(r = 0.2, K = 100), cov = TRUE, Plot_est = TRUE)