The Use of R Programming Language for Modelling In vitro Rumen Fermentation Gas Production

. The in vitro gas production technique is one of the feed evaluation methods that capture the characteristics of rumen microbial fermentation in response to the gas produced by feed ingredients. The gas production response is related and modelled to a unit of time with several parameters using non-linear regression mathematical equations. To facilitate this task, a script program in R has been developed that can perform the intended calculations. The calculation process uses nonlinear mathematical equations with intercepts. The equation shows that gas production (P) (mL) is influenced by several constants that indicate the share of gas production from the soluble fraction (FA) (mL), gas production from the potentially soluble part (FB) (mL), gas production rate (KC) (mL/h) and incubation time (T) (h). In addition to P and T, the three constants are tried to be derived by the program created. The data set is taken from several in vitro gas production studies that have been conducted previously. The Neway Software program of curve fitting calculations was used to validate the results, as the mean difference was tested using an unpaired T-test. Both programs showed the same calculation results for FA (P=0.9996), FB (P=0.9998), and KC (P=0.9962). The residual standard error (RSE) and R-square (R2) values of both programs also came with the same result they were RSE (P =0.9978), and R2 (P=0.6087) respectively. This shows that the R program script made can carry out the calculation process of making a model of the gas production equation for modeling in vitro gas production from rumen fermentation.


Introduction
The feed evaluation technique uses live livestock (in vivo), especially for ruminant livestock, apart from requiring the availability of large numbers of livestock to fulfil statistical sampling, it also involves a long maintenance process.One way to evaluate feed quickly and simply is to carry out in vitro evaluation techniques which involve the use of rumen fluid in the feed material substrate fermentation process [1].A fairly accurate response was shown by in vitro techniques to predict in vivo results in reducing CH4 emissions due to the addition of tannin [2].To represent observation data resulting from substrate incubation, a calculation process is needed to fit the response data into a mathematical equation that explains the conditions of the substrate incubation process in more detail and specifically [3].In practice, the data fitting calculation process requires the help of a computer program to carry out calculations quickly and accurately.For this purpose, a program script has been created in the R programming language which can be replicated to carry out the data fitting calculation process from the substrate fermentation process by rumen fluid in vitro.

2
Materials and Methods

Model
The nonlinear equation from [4] was used as a model to characterise the gas production from rumen fermentation in vitro.The equation was described below : P = a+b (1-e-ct)   ( With P = total gas production (mL), a = gas distribution from soluble fraction (mL), b = gas production from the potentially soluble part (mL), c = gas production rate (mL/h) e = euler's number.

Data Source and Statistical Method
Data sets were taken with kind permission from [5] and [6] which reported the supplementation of organic minerals, probiotics, inulin, and protected amino acids into ruminal feed (20 observation data) and the use of swimming crab shells in dietary feed (14 observation data) to the response of ruminal gas production in vitro respectively.Both studies used The Neway program [7] to predict the kinetic equation of gases produced from rumen fermentation in vitro.This Neway program is an external add-in program for Microsoft Excel that calculates and displays parameter values from the equation (a, b, c) along with measures of the accuracy of the prediction, i.e.Residual Standard Error (RSE), and Discriminant Coefficient (R2).To compare with the previous analysis results we use R program version 4.2.3.[8] edited on RStudio ver.[9] with minpack.lmver.1.2.4.[10] package for statistical calculation, for data manipulation and others used : broom ver.1.0.5 [11], writexl ver.1.4.2[12], dplyr ver.1.1.3[13], shiny ver.1.7.5.1 [14], readr ver.2.1.4[15], openxlsx ver.4.2.5.2 [16] , shinythemes ver.1.2.0 [17] and ggplot2 ver.3.4.4[18].The mean of the results was analyzed using the T-test Two-Sample Assuming Equal Variances from Microsoft Excel ver.2010 data analysis.Some of the parts of the R script were produced from the response of personal communication with ChatGPT version GPT-3.5 [19].The flow of the script for the calculation process is described at Figure 1.
First, we collect the base data from MS Excel in the form of a .csvfile (Comma Separated Value).The file itself should be organised in a data set constructed with the first variable/ column representing numerical data indicating the observation time points (hours), which will be used as predictive data and paired with dependent data from the 2nd column onwards, representing gas production response (mL) from each sample.The pairs of data will be used to calculate their regression characteristics using the nlsLM function [10] from the R minpack.lmpackage based on the nonlinear regression equation proposed [4].The calculated constant values will be collected as a data frame and stored in a .xlsxfile (downloadable).Meanwhile, for the visualisation process, the data pairs will be displayed in the form of a 2D non-linear regression graph, and this graph can be saved in a .jpegformat.

Results and Discussion
This program generates web-based output that displays a data frame from a .csvfile as observational data to be calculated and also displays the result data frame (Figure 2.).Visually, it also presents a graph illustrating the relationship between the observation time data and the gas production response from the samples tested (Figure 3.).The calculations data frame and the graph results could be downloaded into the desired location in the local computer directory.The calculation results show that both software (Neway and R) are able to completely produce the requested non-linear equation calculation based on the constant values that appear (Table 1).The value of the constant "a" shows results that are not significantly different (P = 0.9996) for the two software's.The two softwares Neway and R also produce values that are not different for the constants "b" (P = 0.998) and "c" (P = 0.9962).The Neway program produces information about the effectiveness of predictions from the resulting equation in the form of Residual Standard Error (RSE) values and Coefficient of Determination (R2) values as well as the R program.The results of statistical analysis show that the RSE and R2 values for the two programs are not significantly different (P=0.9978 ) and (P=0.607)respectively.The R program on the other hand is able to provide information on the statistical values attached to each calculated constant.The statistical values in question are the standard deviation (Std) value and the P value (P), these two values are not displayed in the Neway program.The relationship between the graphical prediction results for all components (a,b,c, RSE, R2) between the Neway calculation results and R shows the same linear pattern (Figure 3 : 8).
The Neway program [7] is a program using a Solver program which is an add-in program to Microsoft Excel.This Add in Solver program is capable of carrying out calculation processes to achieve optimization conditions that produce the maximum or minimum value of the final goal to be achieved [20] so that this program is able to carry out calculations for curve fitting.The Neway program creates a fitting curve with a single calculation using only the [4] equation.On the other hand, the R program is an open source program that has a domain for statistical calculations and graphics [9].The use of the R program package "minpack.lm"[10] for modelling in vitro gas production is in accordance with the use of the R program package -"drc" which can be used to calculate eight mathematical models for in vitro gas production and feed degradation in sacco [3]. 2)Constans equation for gas production from rumen invitro fermentation [4] i.e, "a" : gas production form rapid soluble fraction (mL), "b" : gas portion from potential degraded material (mL), "c" : gas production rate (mL/h)

Conclusion
The use of the R program script that has been made in this paper is able to carry out the modelling process for the process of calculating non-linear mathematical equations for gas production from rumen fluid fermentation in vitro.

Table 1 .
The modelling results of the gas production from rumen fermentation in vitro [8]oftware used for fitting curve i.e.Neway[7]and R Program 4.2.3[8]