model_selection {SpatialModelsZAMG}R Documentation

Find best linear models according to AIC

Description

this function calculates the pointwise GEV parameter estimates for each station and finds the best linear models according to Akaike Information Criterion (AIC)

Usage

model_selection(max_data, covariables, at_least_data = 30,
                plot_station_distr = FALSE)

Arguments

max_data

a matrix with the yearly maxima of snow depth (sd) or snow water equivalent (swe). each row corresponds to one station, columns are the corresponding years. matrix might contain NA's

covariables

a matrix with the covariables for each station. each row corresponds to one station, columns should include at least lon (longitude), lat (latitude) and alt (altitude)

at_least_data

how many measurements does each station has to have at least for the model selection.
default is at_least_data = 30

plot_station_distr

logical value; if TRUE, a plot with the distribution of the used stations for the model selection is generated.
default is FALSE

Value

a list with

max_data

the given max_data matrix

covariables

the given covariables matrix

point_est

a matrix with the pointwise GEV parameter estimates. each row corresponds to one station, columns are loc (location parameter), scale (scale parameter) and shape (shape parameter)

models

a list of lm-class objects with the best fitted linear models for the GEV parameters:
loc_model: loc ~ … ,
scale_model: scale ~ … ,
shape_model: shape ~ …

used_for_model_selection

the indices of the stations which were used for the model selection. you can use it for example as max_data[used_for_model_selection,] to get the maxima data of all stations used for the model selection

See Also

get_data_from_Robj, optimizer_smooth_model, optimizer_biv_hr_model

Examples

# load function output from get_data_from_Robj
get_data = get(data("get_data"))

# define covariables for sd and swe in order
# to perform model selection (drop swe_mmax
# for sd and sd_mmax for swe model selection)

sd_covariables  = get_data$covariables[,-6]
swe_covariables = get_data$covariables[,-5]

# perform model selection
sd_m_select =
  model_selection(max_data = get_data$sd_max_data,
                  covariables = sd_covariables,
                  at_least_data = 10)

swe_m_select =
  model_selection(max_data = get_data$swe_max_data,
                  covariables = swe_covariables,
                  at_least_data = 10)

[Package SpatialModelsZAMG version 1.0.2 Index]