Description Usage Arguments Value Details Author(s) Examples

Stacked species regression models, possibly fitted in parallel

1 2 3 4 5 6 7 8 9 10 |

`y` |
A matrix of species responses |

`formula_X` |
An object of class |

`data` |
Data frame of the covariates |

`family` |
Either a single character vector, in which case all responses are assumed to be from this family, or a vector of character strings of the same length as the number of columns of y. Families as strings and not actual |

`trial_size` |
The trial size if any of the responses are binomial. Is either a single number or a matrix with the same dimension as y. If the latter, then all columns that do not correspond to binomial responses are ignored. |

`do_parallel` |
Do the separate species model fits in parallel? Defaults to |

`ncores` |
The number of cores to use if separate the species model fits are done in parallel. If |

`trace` |
Print information. This is not actually used currently |

A object of class `stackedsdm`

with the following components:
`call`

The function call;
`fits`

A list where the j-th element corresponds to the to the fitted model for species j i.e., the j-th column in `y`

;
`linear_predictor`

A matrix of the fitted linear predictors
`fitted`

A matrix of the fitted values

`stackedsdm`

behaves somewhat like the `manyglm`

or `manyany`

function in the package `mvabund`

, in the sense that it fits a separate regression to each species response i.e., column of `y`

. The main difference is that different families can be permitted for each species, which thus allows for mixed responses types.

Francis K.C. Hui <francis.hui@anu.edu.au>.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
X <- as.data.frame(spider$x)
abund <- spider$abund
# Example 1: Simple example
myfamily <- "negative.binomial"
# Example 1: Funkier example where Species are assumed to have different distributions
# Fit models including all covariates are linear terms, but exclude for bare sand
fit0 <- stackedsdm(abund, formula_X = ~. -bare.sand, data = X, family = myfamily, ncores = 2)
# Example 2: Funkier example where Species are assumed to have different distributions
abund[,1:3] <- (abund[,1:3]>0)*1 # First three columns for presence absence
myfamily <- c(rep(c("binomial"), 3),
rep(c("negative.binomial"), (ncol(abund)-3)))
fit0 <- stackedsdm(abund, formula_X = ~ bare.sand, data = X, family = myfamily, ncores = 2)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.