StempCens (version 0.1.0)

CovarianceM: Covariance matrix for spatio-temporal model

Description

It computes the spatio-temporal covariance matrix. For the spatial function we have 5 differents correlation matrix: exponential, gaussian, matern, spherical and power exponential correlation matrix; and for the temporal function is a correlation matrix of an autorregressive model AR(1).

Usage

CovarianceM(phi, rho, tau2, sigma2, distSpa, disTemp, kappa, type.S)

Arguments

phi

value of the spatial scaling parameter.

rho

value of the time scaling parameter.

tau2

value of the the nugget effect parameter.

sigma2

value of the the model variance.

distSpa

Spatial distance matrix without considering repetitions.

disTemp

Temporal distance matrix without considering repetitions.

kappa

parameter for all spatial covariance functions. In the case of exponential, gaussian and spherical function \(\kappa\) is equal to zero.

type.S

type of spatial covariance function: 'exponential' for exponential, 'gaussian' for gaussian, 'matern' for matern, 'pow.exp' for power exponential and 'spherical' for spherical function, respectively. Default is exponential function.

Value

The function returns the spatio-temporal covariance matrix.

Examples

Run this code
# NOT RUN {
# Initial parameter values
beta <- c(-1,1.50); phi <- 5; rho <- 0.45; tau2 <- 0.80; sigma2 <- 2
# Simulating data
n1 <- 10   # Number of spatial locations
n2 <- 5    # Number of temporal index
set.seed(1000)
x.coord <- round(runif(n1,0,10),9)    # X coordinate
y.coord <- round(runif(n1,0,10),9)    # Y coordinate
coordenadas <- cbind(x.coord,y.coord) # Cartesian coordinates without repetitions
time <- as.matrix(seq(1,n2,1))        # Time index without repetitions
# Covariance matrix
H <- as.matrix(dist(coordenadas)) # Spatial distances
Mt <- as.matrix(dist(time))       # Temporal distances
Cov <- CovarianceM(phi,rho,tau2,sigma2,distSpa=H,disTemp=Mt,kappa=0,type.S="exponential")
# }

Run the code above in your browser using DataLab