varianceAnalysis: Variance analysis of RasterStack objects

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/varianceAnalysis.R

Description

Extract componets of lists of objects (as returned by function mopaPredict) and perform variance analysis to obtain raster objects of the contribution of each component to the observed varaibility.

Usage

1
varianceAnalysis(predictions, component1, component2, fixed = NULL)

Arguments

predictions

listed lists of raster objects as returned by mopaPredict

component1

Character. Options are "SP", "PA", "SDM", "baseClim" and "newClim" (see Details). If exist, "foldModel" is another option. Selected option corresponds to the first component in the variance analysis.

component2

Character. Options are "SP", "PA", "SDM", "baseClim" and "newClim" (see Details). If exist, "foldModel" is another option. Selected option corresponds to the second component in the variance analysis.

fixed

Optional. Character of the component names corresponding to the components that are not being analyzed (component3, component4...). One name for each component is provided, components that only have one choice (e.g. a single species, a single baseline climate, etc.) are internally fixed. If fixed = NULL the first element of each component is selected. If fixed is specified, the selected name must be provided for each of the components that have multi-choices.

Details

Rasters are extracted using function grep, by matching names in the lists and characters in componen1 and componen2. The contribution of componen1 in front component2 to the spread (uncertainty) of the projected probabilities in predictions is here assessed using a simple analysis of variance approach, where the total variance (V) can be decomposed as the summation of the variance explained by component1 (Vcomp1), component2 (Vcomp2) and the combination of the previous two (Vcomp12):

V = Vcomp1 + Vcomp2 + Vcomp12.

Description of the components:

Value

A list of two RasterStack objects, the first containing the global mean and standard deviation and the second containing the percentage of variance correponding to each component in the analysis (component1, component2 and components 1 and 2).

Author(s)

M. Iturbide

References

San Martin, D., Manzanas, R., Brands, S., Herrera, S., & Gutierrez, J.M. (2016) Reassessing Model Uncertainty for Regional Projections of Precipitation with an Ensemble of Statistical Downscaling Methods. Journal of Climate 30, 203-223.

See Also

varianceSummary

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Load climate data
destfile <- tempfile()
data.url <- "https://raw.githubusercontent.com/SantanderMetGroup/mopa/master/data/biostack.rda"
download.file(data.url, destfile)
load(destfile, verbose = TRUE)

## Fitted models
data(mods)
?mods

## Model prediction and analysis of the variability in projections
newClim <- lapply(1:4, function(x){
crop(biostack$future[[x]], extent(-10, 5, 35, 60))
})

prdRS.fut <- mopaPredict(models = mods, newClim = newClim)
result <- varianceAnalysis(prdRS.fut, "PA", "newClim")
spplot(result$variance, col.regions = rev(get_col_regions()))

mopa documentation built on May 2, 2019, 6:47 a.m.