knitr::opts_chunk$set(fig=TRUE, warning=FALSE, message=FALSE, 
                      eval=TRUE, cache=FALSE,
                      comment = '#>', collapse=TRUE, dev='png')

Introduction

MRSea stands for Marine Renewables Strategic Environmental Assessment. and the package was developed for analysing data that was collected for assessing potential impacts of renewable developments on marine wildlife, although the methods are applicable to any studies where you wish to fit uni or bivariate smooths.

The package enables the fitting of spatially adaptive regression splines using two Spatially Adaptive Local Smoothing Algorithms (SALSA):

For additional information regarding the methods see the Publications Page

The main modelling functions are runSALSA1D and runSALSA2D, which implement the methods for univariate and then bivariate smoothing and these produce models of the class gamMRSea.

Other functions include diagnostics (to assess residual correlation: runACF, smooth relationships: runPartialPlots and model selection (ANOVA) for robust standard errors: anova.gamMRSea) and inference (do.bootstrap.cress).

alt text Example of the modelling process using MRSea. Packages with functions to run certain parts are given in oval boxes. To complete the modelling process, other packages may be used at certain stages. These are coded light blue, whilst MRSea functions are in red.

Examples and tutorials on the MRSea Website

For information on using the package see here for a list of examples and tutorials.

knitr::include_url("https://lindesaysh.github.io/MRSea/articles/website_examples.html")

Translating from glm to gamMRSea

Making any glm model into an gamMRSea object

This can be done using the make.gamMRSea function. Here we use the fullmodel which is a glm model with family='poisson'

library(MRSea)
data("nysted.analysisdata")
fit <- glm(response ~ season + depth, family="quasipoisson", data = nysted.analysisdata)
fullModel.gamMRSea <- make.gamMRSea(fit,
                                    gamMRSea = TRUE)
summary(fullModel.gamMRSea)

Note that there is an extra column for robust standard errors but that they are the same as the raw ones. No panel structure has been specified and this is shown at the bottom of the output Max Panel Size = 1.

Adding a panel structure to a model

Additionally, if you choose to fit the SALSA or GLM models without a panel structure, the make.gamMRSea function can be used to add a panel structure afterwards. Note that now in the summary output, the robust standard error column is different to the raw standard errors as they have been adjusted for any correlation seen in the panels. The output shows that the maximum panel size is now 54 and there are 208 panels.

fit.robustse <- make.gamMRSea(fit,
                              gamMRSea = TRUE,
                              panelid = nysted.analysisdata$transect.id)
summary(fit.robustse)


lindesaysh/MRSea documentation built on May 11, 2024, 11:30 p.m.