modeldef: Define a model for the spatial behaviour of the GEV...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/modeldef.R

Description

This function defines the model for the spatial behaviour of the GEV parameter.

Usage

1

Arguments

data

A matrix representing the data. Each column corresponds to one location.

formula

A R formula. See details for further details.

Value

need to be documented

Author(s)

Mathieu Ribatet

See Also

formula

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 1- A design matrix from a classical linear model 
n.site <- 5
coord <- matrix(rnorm(2*n.site, sd = sqrt(.2)), ncol = 2)
colnames(coord) <- c("lon", "lat")
loc.form <- loc ~ lat + I(lon^2)
modeldef(coord, loc.form)

## 2- A design and penalization matrix from a penalized smoothin spline
x <- sort(runif(10, -2, 10))
n.knots <- 3
knots <- quantile(x, prob = 1:n.knots / (n.knots + 2))
modeldef(x, y ~ rb(x, knots = knots, degree = 3, penalty = 1))

Example output

$dsgn.mat
  (Intercept)         lat    I(lon^2)
1           1 -0.14077324 0.214131639
2           1  0.06641161 0.058950527
3           1  0.76666221 0.008168428
4           1  0.29073758 0.020695799
5           1  0.26189283 0.039923285
attr(,"assign")
[1] 0 1 2

$pen.mat
[1] 0

$degree
[1] 0

$knots
[1] 0

$type
[1] "lm"

$penalty.tot
[1] 0

$formula
loc ~ lat + I(lon^2)

$data
             lon         lat
[1,]  0.46274360 -0.14077324
[2,] -0.24279730  0.06641161
[3,]  0.09037936  0.76666221
[4,]  0.14386035  0.29073758
[5,]  0.19980812  0.26189283

$init.fun
function (y) 
lm(formula, data = as.data.frame(cbind(y = y, data)))$coeff
<environment: 0x3c07800>

$n.ppar
[1] 3

$dsgn.mat
            x                                    
 1 -0.5301743 1.185161e+01 111.586688 323.3224197
 1  1.5442645 8.680063e-03  20.568776 109.8372399
 1  1.8011567 1.356260e-04  15.308724  93.0929173
 1  2.5635252 5.388504e-01   5.094204  53.5738808
 1  5.4312724 4.989676e+01   1.509394   0.7339869
 1  5.8227710 6.756798e+01   3.642294   0.1330798
 1  7.0991434 1.530759e+02  22.305977   0.4491444
 1  8.1863901 2.666687e+02  59.420200   6.3632001
 1  8.6984331 3.355075e+02  86.014882  13.2298756
 1  9.8152366 5.246711e+02 169.209926  42.2138650

$pen.mat
     [,1] [,2]      [,3]     [,4]      [,5]
[1,]    0    0   0.00000  0.00000   0.00000
[2,]    0    0   0.00000  0.00000   0.00000
[3,]    0    0 112.57379 28.78467  11.83508
[4,]    0    0  28.78467 24.88319  39.59254
[5,]    0    0  11.83508 39.59254 104.89933

$degree
[1] 3

$knots
     20%      40%      60% 
1.749778 4.284174 6.333320 

$type
[1] "rb"

$penalty.tot
[1] 1

$init.fun
function (y) 
rbpspline(y, data, knots, degree, penalty)$beta
<environment: 0x33320a0>

$penalty
[1] 1

$formula
y ~ rb(x, knots = knots, degree = 3, penalty = 1)

$data
               x
 [1,] -0.5301743
 [2,]  1.5442645
 [3,]  1.8011567
 [4,]  2.5635252
 [5,]  5.4312724
 [6,]  5.8227710
 [7,]  7.0991434
 [8,]  8.1863901
 [9,]  8.6984331
[10,]  9.8152366

$n.ppar
[1] 2

SpatialExtremes documentation built on Sept. 1, 2020, 3:01 a.m.