This tutorial demonstrates how to use the `SEAGLE`

package when the user inputs \({\bf y}\), \({\bf X}\), \({\bf E}\), and \({\bf G}\) from .txt files. We’ll begin by loading the `SEAGLE`

package.

```
library(SEAGLE)
#> Loading required package: Matrix
#> Loading required package: CompQuadForm
```

If you have your own files ready to read in for \({\bf y}\), \({\bf X}\), \({\bf E}\), and \({\bf G}\), you can read them into R using the `read.csv()`

command.

As an example, we’ve included `y.txt`

, `X.txt`

, `E.txt`

, and `G.txt`

files in the `extdata`

folder of this package. The following code loads those files into R so we can use them in this tutorial.

```
<- system.file("extdata", "y.txt", package = "SEAGLE")
y_loc <- as.numeric(unlist(read.csv(y_loc)))
y
<- system.file("extdata", "X.txt", package = "SEAGLE")
X_loc <- as.matrix(read.csv(X_loc))
X
<- system.file("extdata", "E.txt", package = "SEAGLE")
E_loc <- as.numeric(unlist(read.csv(E_loc)))
E
<- system.file("extdata", "G.txt", package = "SEAGLE")
G_loc <- as.matrix(read.csv(G_loc)) G
```

Now we can input \({\bf y}\), \({\bf X}\), \({\bf E}\), and \({\bf G}\) into the `prep.SEAGLE`

function. The `intercept = 1`

parameter indicates that the first column of \({\bf X}\) is the all ones vector for the intercept.

This preparation procedure formats the input data for the `SEAGLE`

function by checking the dimensions of the input data. It also pre-computes a QR decomposition for \(\widetilde{\bf X} = \begin{pmatrix} {\bf 1}_{n} & {\bf X} & {\bf E} \end{pmatrix}\), where \({\bf 1}_{n}\) denotes the all ones vector of length \(n\).

`<- prep.SEAGLE(y=as.matrix(y), X=X, intercept=1, E=E, G=G) objSEAGLE `

Finally, we’ll input the prepared data into the `SEAGLE`

function to compute the score-like test statistic \(T\) and its corresponding p-value. The `init.tau`

and `init.sigma`

parameters are the initial values for \(\tau\) and \(\sigma\) employed in the REML EM algorithm.

```
<- SEAGLE(objSEAGLE, init.tau=0.5, init.sigma=0.5)
res $T
res#> [1] 246.1886
$pv
res#> [1] 0.8441451
```

The score-like test statistic \(T\) for the G\(\times\)E effect and its corresponding p-value can be found in `res$T`

and `res$pv`

, respectively.