Takes a matrix of observations, and fits the specified GLM on each species, returning the matrix of coefficients.
matrix_glm(x, Map, formula, family, response.name, verbose, ...) # S3 method for default matrix_glm(x = NULL, Map = NULL, formula = NULL, family = poisson(link = "log"), response.name = "Count", verbose = FALSE, ...) # S3 method for Dataset matrix_glm(x, formula = NULL, family = poisson(link = "log"), response.name = "Count", verbose = FALSE, ...)
x | Either a matrix of abundances with samples as columns and species as rows or a Dataset object |
---|---|
Map | A data.frame containing the variables to be modelled as columns and samples as rows. The rows should be named with sample IDs and must correspond to the column names from x if an abundance matrix was passed |
formula | A formula specifying the model to be fit. Only the right hand side of the equation must be passed, and anything on the left side wild be silently ignored |
family | The GLM fmaily to be used. It must be an object of class family. use ?family for more help |
response.name | String indicating the name to be used for the response (dependent) variable in the GLM |
verbose | Logical value. If true the taza name is printed while the fit is in progress. |
... | Other parameters for the glm() function like control. |
Returns a matrix.glm object which is a list containing the following elements:
A matrix of coefficients for the glm fit. The matix has dimensions S x p, where S is the number of species in the abundance matrix, and p the number of parameters in the specified GLM. Each row corresponds to an independent fit of the model with glm() function and the specified formula
Similar to Coef, but this matrix contains the estimated Standard Errors (ie. the Standard deviation of the coefficients).
A named vector containing the Akaike Information Criteria (AIC) of each independent fit. The names of the vector correspond to the species IDs in the input abundance matrix
Function call via match.call
GLM model family. An object of class family
Design matrix of the model fit.
This function will take each species (row) in the abundance matrix and fit the specified (cia the formula option) GLM independently on each one.