# Prediction of Weights during Growth Stages of Onion Using Agricultural Data Analysis Method
## 3 Dataset and Method
### Method  
We considered a functional sequence regression model with \(p\) functional covariates to determine how \(p\) environmental factors influence onion weights \(n\) over time [12; 13; 14]. This model is defined as follows:  
\[y_{i}(t)=\alpha(t)+\sum\
olimits_{k=1}^{p}\sum\
olimits_{s=1}^{q}\beta_{k}(s, t)x_{ik}(s)\ +\epsilon_{i}(t),i=1,\cdots,n \tag{1}\]  
where \(n\) is the number of observations, \(p\) is the number of functional covariates, \(y_{i}(t)\) is onion weight in time \(t\), \(x_{ik}(s)\) is the functional covariate, \(\alpha(t)\) is the mean functional, \(\beta_{k}(s,t)\) is the regression functional for the \(k\)-th covariate, and \(\epsilon_{i}(t)\) is a random error function. In this case, to derive the estimators of the function sequence parameter \(\beta_{k}(s,t)\) of the proposed model, we use a criterion of the least minimum integral squared residual (LMISE) defined as:  
\[\text{LMISE}=\big{\|}y-\vec{y}\big{\|}^{2}=\sum\
olimits_{i=1}^{n}\int_{\mathcal{ T}_{Y}}[y_{i}(t)-(\alpha(t)+\sum\
olimits_{k=1}^{p}\sum\
olimits_{s=1}^{q}x_{ik}(s) \beta_{k}(s,t))]^{2}dt. \tag{2}\] \begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline
**var2** & **var3** & **var4** & **var5** & **var6** & **var7** & **var2** & **var3** & **var4** & **var5** & **var6** & **var7** \\
**(t-7)** & **(t-7)** & **(t-7)** & **(t-7)** & **(t-7)** & **(t-7)** & **(t-1)** & **(t-1)** & **(t-1)** & **(t-1)** & **(t-1)** \\ \hline  
\hline \hline \end{tabular}
\end{table} 
Table 2: Example of input data of environmental variables of growth period. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & **farm1** & **farm2** & **farm3** & **farm4** & **farm5** & **farm6** & **farm7** \\ \hline week8 & 24.724 & 39.583 & 25.433 & 37.5 & 27.792 & 11.733 & 56.533 \\ week9 & 72.067 & 98.375 & 67.067 & 87.767 & 74.75 & 38.133 & 134.2 \\ week10 & 109.27 & 162.71 & 108.82 & 177.75 & 113.92 & 69.626 & 217.97 \\ week11 & 124.2 & 196.33 & 154.97 & 210.73 & 149.42 & 102.2 & 242.07 \\ week12 & 169.47 & 273.13 & 219.8 & 315.93 & 179.04 & 150.7 & 332.7 \\ week13 & 203.03 & 312.88 & 244.13 & 364.77 & 216.25 & 153.37 & 371.52 \\ week14 & 255.62 & 365.46 & 256.2 & 367.3 & 224.03 & 168.15 & 383.07 \\ week15 & 257.3 & 395.73 & 279.3 & 405.03 & 224.79 & 192.63 & 389.3 \\ week16 & 292.7 & 403.75 & 314.4 & 467.7 & 225.65 & 193.67 & 415.17 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Example of input data of onion weight of growth period. Furthermore, we are going to consider the minimization of the criterion LMISE \((\text{B}_{k})\) given at Formula (12). In this case, if \(\text{J}_{\phi_{k}}\) and \(\text{J}_{\psi}\) are identity matrices, and the matrix \(\text{B}_{k}\) will minimize the Formula (12) if and only if  
\[\text{C}_{k}^{T}\text{C}_{k}\text{B}_{k}=\text{C}_{k}^{T}\text{D}\]  
so that  
\[\text{B}_{k}=\left(\text{C}_{k}^{T}\text{C}_{k}\right)^{-1}\text{C}_{k}^{T} \text{D}. \tag{13}\]  
The matrix \(\text{B}_{k}\) is easily found by using the singular value decomposition (SVD) of \(\text{C}_{k}\). Here, we have obtained \(\text{C}_{k}=\text{U}\Delta_{\text{C}_{k}}\text{V}^{T}\), where \(\Delta_{\text{C}_{k}}\) is a diagonal matrix with strictly positive diagonal elements and U and V have orthogonal columns. Then,  
\[\text{C}_{k}^{T}\text{C}_{k}=\text{V}\Delta_{\text{C}_{k}}^{2}\text{V}^{T}, \tag{14}\]  
and hence the Moore-Penrose g-inverse of \(\text{C}_{k}^{T}\text{C}_{k}\) is \(\text{V}\Delta_{\text{C}_{k}}^{-2}\text{V}^{T}\). Substituting it into (13) gives us the following equation:  
\[\text{B}_{k}=\text{V}\Delta_{\text{C}_{k}}^{-1}\text{U}^{T}\text{D} \tag{15}\]  
Therefore, if we substitute \(\text{B}_{k}\) into \(\beta_{k}(s,t)\) in Equation (7), we get the following functional estimates for functional regression coefficients:  
\[\widehat{\beta_{k}}(s,t)=\phi_{k}^{T}(s,t)\widehat{\text{B}}_{k}\psi \tag{16}\]  
Finally, we can obtain the following predicted equation for response values:  
\[\widehat{y}(t)=\overline{y}(t)+\sum\limits_{k=1}^{p}\int_{I_{s}}x_{ik}(s) \widehat{\beta_{k}}(s,t)ds \tag{17}\]