Package 'dryingkineticmodels'

Title: Drying Kinetic Models Comparison and Analysis
Description: Fits multiple thin-layer drying kinetic models to experimental moisture ratio data, compares model performance using statistical criteria, performs residual diagnostics, identifies the best-fitting model, and exports results to Word documents. Twenty models from Ertekin and Firat (2017) <doi:10.1016/j.jfoodeng.2016.09.030> are fitted using the Levenberg-Marquardt algorithm described in Marquardt (1963) <doi:10.1137/0111030>.
Authors: Joshy C G [aut, cre], Devika S [aut]
Maintainer: Joshy C G <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2026-07-21 14:48:06 UTC
Source: https://github.com/cran/dryingkineticmodels

Help Index


dryingkineticmodels: Drying Kinetic Models Comparison and Analysis

Description

Fits multiple thin-layer drying kinetic models to experimental moisture ratio data, compares model performance using statistical criteria, performs residual diagnostics, identifies the best-fitting model, and exports results to Word documents. Twenty models from Ertekin and Firat (2017) doi:10.1016/j.jfoodeng.2016.09.030 are fitted using the Levenberg-Marquardt algorithm described in Marquardt (1963) doi:10.1137/0111030.

Author(s)

Maintainer: Joshy C G [email protected]

Authors:


Drying Kinetic Model Comparison and Analysis

Description

Fits 20 thin-layer drying kinetic models to experimental moisture ratio data, ranks them by a composite goodness-of-fit criterion (R2^2, RMSE, and χ2\chi^2), identifies the best model, predicts moisture ratio (MR) using the best model, performs residual diagnostic tests, and exports a fully formatted report to a Word document.

Usage

dryingkineticmodels(
  file_path,
  verbose = FALSE,
  models = NULL,
  export_word = FALSE
)

Arguments

file_path

Either a character string giving the path to an .xlsx file, or a data frame. In both cases the first two numeric columns are used as time and MR.

verbose

Logical. If TRUE, also prints detailed diagnostic and progress information to the console via message(). Default FALSE. Regardless of this setting, a short note confirming which columns were used as TIME and MR is always printed, since choosing the wrong columns silently would give incorrect results.

models

Optional character vector naming which of the 20 models to fit (see Details for valid names). If NULL (default), all 20 models are fitted, preserving prior behavior. Fitting fewer models is faster and is mainly useful for quick checks or small examples.

export_word

Logical. If TRUE, builds and exports a Word document summarizing the model comparison, diagnostics, and plots. If FALSE (default), skips Word export and only returns the results list.

Details

The function expects the input to have at least two numeric columns. The first numeric column is treated as drying time as 'time' and the second as moisture ratio as 'MR'. Reorder your columns in Excel if needed before calling the function.

The 20 models fitted are: Lewis, Page, Modified Page, Henderson & Pabis, Logarithmic, Two-Term, Two-Term Exponential, Diffusion Approximation, Wang & Singh, Midilli-Kucuk, Modified Henderson & Pabis, Verma, Weibull, Aghbashlo et al., Jena & Das, Hii et al., Parabolic, Thompson, Demir et al., and Thin-Layer Exponential-Linear. The corresponding names to use with the models argument are "Lewis", "Page", "Modified_Page", "Henderson_Pabis", "Logarithmic", "Two_Term", "Two_Term_Exponential", "Diffusion_Approximation", "Wang_Singh", "Midilli_Kucuk", "Modified_Henderson_Pabis", "Verma", "Weibull", "Aghbashlo", "Jena_Das", "Hii_et_al", "Parabolic", "Thompson", "Demir_et_al", and "Thin_Layer_ExpLin".

Starting values are obtained via a coarse grid search using nlsLM, making the fitting robust across a wide range of datasets without requiring manual starting value specification.

Goodness-of-fit statistics reported are R2^2, RMSE, MAE, χ2\chi^2, and RSS. Model ranking uses the combined rank of R2^2, RMSE, and χ2\chi^2 following Goyal et al. (2007).

Residual diagnostics include the Shapiro-Wilk test (normality), Durbin-Watson test (autocorrelation), Breusch-Pagan test (homoscedasticity), and Runs test (randomness).

Value

A list (returned invisibly) with five elements:

comparison_table

Data frame of all model fit statistics, sorted by composite rank.

best_model

The result list for the best-fitting model.

anova_table

ANOVA table for the best model.

predicted_MR

Data frame containing observed time, observed MR, predicted MR, residuals, and 95\ the best-fitting model.

columns_used

Data frame recording which input columns were used as TIME and MR. Always check this to confirm correct column selection, especially when verbose = FALSE.

References

Goyal, R. K., Kingsly, A. R. P., Manikantan, M. R., & Ilyas, S. M. (2007). Mathematical modelling of thin layer drying kinetics of plum in a tunnel dryer. Journal of Food Engineering, 79(1), 176–180. doi:10.1016/j.jfoodeng.2006.01.041

Examples

# Small, fast toy example (runs automatically during R CMD check)
toy_df <- data.frame(
  time = c(0, 30, 60, 90, 120, 150),
  MR   = c(1.00, 0.72, 0.51, 0.36, 0.26, 0.18)
)
toy_result <- dryingkineticmodels(toy_df, models = c("Lewis", "Page"),
                                   export_word = FALSE)
toy_result$comparison_table


# Fuller example using a bundled sample dataset (slower, includes Word export)
sample_file <- system.file("extdata", "sample_drying_data.csv",
                           package = "dryingkineticmodels")
df <- read.csv(sample_file)
result <- dryingkineticmodels(df, export_word = TRUE)