Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Regression

Computes The Regression Of An Array On Another Along A Dimension


Description

Computes the regression of the input matrice vary on the input matrice varx along the posREG dimension by least square fitting. Provides the slope of the regression, the associated confidence interval, and the intercept.
Provides also the vary data filtered out from the regression onto varx.
The confidence interval relies on a student-T distribution.

Usage

Regression(vary, varx, posREG = 2)

Arguments

vary

Array of any number of dimensions up to 10.

varx

Array of any number of dimensions up to 10. Same dimensions as vary.

posREG

Position along which to compute the regression.

Value

$regression

Array with same dimensions as varx and vary except along posREG dimension which is replaced by a length 4 dimension, corresponding to the lower limit of the 95% confidence interval, the slope, the upper limit of the 95% confidence interval and the intercept.

$filtered

Same dimensions as vary filtered out from the regression onto varx along the posREG dimension.

Author(s)

History:
0.1 - 2013-05 (V. Guemas, virginie.guemas@ic3.cat) - Original code
1.0 - 2013-09 (N. Manubens, nicolau.manubens@ic3.cat) - Formatting to CRAN

Examples

# See examples on Load() to understand the first lines in this example
 ## Not run: 
data_path <- system.file('sample_data', package = 's2dverification')
expA <- list(name = 'experiment', path = file.path(data_path,
            'model/$EXP_NAME$/$STORE_FREQ$_mean/$VAR_NAME$_3hourly',
            '$VAR_NAME$_$START_DATE$.nc'))
obsX <- list(name = 'observation', path = file.path(data_path,
            '$OBS_NAME$/$STORE_FREQ$_mean/$VAR_NAME$',
            '$VAR_NAME$_$YEAR$$MONTH$.nc'))

# Now we are ready to use Load().
startDates <- c('19851101', '19901101', '19951101', '20001101', '20051101')
sampleData <- Load('tos', list(expA), list(obsX), startDates,
                  output = 'lonlat', latmin = 27, latmax = 48, 
                  lonmin = -12, lonmax = 40)
 
## End(Not run)
 
sampleData$mod <- Season(sampleData$mod, 4, 11, 12, 2)
sampleData$obs <- Season(sampleData$obs, 4, 11, 12, 2)
reg <- Regression(Mean1Dim(sampleData$mod, 2),
                 Mean1Dim(sampleData$obs, 2), 2)
PlotEquiMap(reg$regression[1, 2, 1, , ], sampleData$lon, sampleData$lat, 
           toptitle='Regression of the prediction on the observations', 
           sizetit = 0.5)

s2dverification

Set of Common Tools for Forecast Verification

v2.10.0
Apache License 2.0
Authors
BSC-CNS [aut, cph], Virginie Guemas [aut], Nicolau Manubens [aut], An-Chi Ho [ctb, cre], Nuria Perez-Zanon [ctb], Javier Garcia-Serrano [aut], Neven Fuckar [aut], Louis-Philippe Caron [aut], Omar Bellprat [aut], Luis Rodrigues [aut], Veronica Torralba [aut], Alasdair Hunter [aut], Chloe Prodhomme [aut], Martin Menegoz [aut], Domingo Manubens [ctb], Constantin Ardilouze [ctb], Lauriane Batte [ctb], Fabian Lienert [ctb], Julia Giner [ctb], Jean-Philippe Baudouin [ctb], Nube Gonzalez [ctb], Ludovic Auger [ctb], Nicola Cortesi [ctb], Eleftheria Exarchou [ctb], Ruben Cruz [ctb], Isabel Andreu-Burillo [ctb], Ramiro Saurral [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.