# Analysis of Fluid Velocity inside an Agricultural Sprayer Using Generalized Linear Mixed Models
## 1 Introduction
### Theoretical Sequencing of the Model  
The conditional distribution of each \(y_{ij}\), given a vector \(q\times 1\) of random effects \(u_{i}\), belongs to the exponential family of distributions (positive or negative binomial, Poisson, normal, and gamma, among others). The variance is given by \((y_{ij}|u_{i})=\phi v(E(y_{ij}|u_{i}))\), where, \(v(\cdot)\) is a known function for the variance, a function of the conditional mean \(E(y_{ij}|u_{i})\), and \(\phi\) is a scalar parameter that may be known or needs to be estimated. It should be noted that, given the random effects \(u_{i}\), it is assumed that values of \(y_{ij}\) are independent of each other, which assumes conditional independence [12]. The conditional mean of \(y_{ij}\), which is dependent on the fixed effects (FE) \(\beta\) and random effects (RE) \(u_{i}\), is linked to the linear predictor \(\eta_{ij}\), through the application of a known linkage function, \(g(\cdot)\), which is monotonous and differentiable [13], as follows (Equation (2)):  
\[g[E(y_{ij}|u_{i};x_{ij};z_{ij})]=\eta_{ij}=x_{ij}^{T}\beta+z_{ij}^{T}u_{i}, \tag{2}\]  
where, \(x_{ij}\) and \(z_{ij}\) are two vectors of covariates \(p\times 1\) and \(1\times q\) dimensional, respectively. Although any function can be chosen for \(g(\cdot)\), each distribution belonging to the exponential family has a special linking function called the canonical linking function. The known linkage function \(g(\cdot)\) is given by (Equation (3)):  
\[g[E(y_{ij})]=\theta_{i}, \tag{3}\]  
where, \(\theta_{i}\) is the canonical location parameter. Generally, any multivariate distribution can be supported for \(u_{i}\). In practice, it is common to assume that the \(u_{i}\) has a multivariate normal distribution [14], with zero mean and variance-covariance matrix \(G\), sized \(q\times q\)[15], where \(G\) is some function of \(\theta\). Additionally, the RE \(u_{i}\) are assumed to be independent of covariates \(x_{i}\), if any. The adjustment of the model requires the maximization of the marginal likelihood, which is obtained by integrating the RE. The form of distribution of RE has a notable influence on the unbiased inference of the maximum likelihood estimators (MLE) of FE [14]. Software packages offer several answers to solve this [16]. SPSS and SAS, by default, use iterative linear methods that maximize the penalized quasi-likelihood residual (PQL [17; 18; 19]; RSPL method in SAS), whose main criticism is that the inference of the plausibility that it may be inappropriate, as it generates a bias for large variances or small means. Existing methods to approximate the likelihood to estimate GLMM parameters include, marginal quasi-likelihood methods (MQL) [20], Laplace approximations [21], Gauss-Hermite quadrature (GHQ) [22], and Markov chain Monte Carlo (MCMC) algorithms [23]. Adaptive quadrature (GHQ) or Laplace approximationsare the preferred methods for categorical response variables [15; 22; 24]. Residual methods account for the FE in the construction of the objective function, which reduces the bias in covariance parameter estimates. Estimation methods involving the Taylor series create pseudo-data for each optimization, which are transformed to have a zero mean in a residual method. While the covariance parameter estimates in a residual method are the maximum likelihood estimates for the transformed problem, the fixed-effects estimates are (estimated) the generalized least squares estimates. In a likelihood method that is not residual based, both the covariance parameters and the fixed-effects estimates are maximum likelihood estimates, but the former are known to have greater bias. In certain problems, residual likelihood estimates of covariance parameters are unbiased. The degrees of freedom (df) for RE, required for Wald tests or F tests or Akaike's information criteria (AICc), must be between 1 and N-1 (where N is the number of RE levels). Software packages vary enormously in their approach to computing df.