Learn R Programming

covatest (version 1.0.1)

blocks-class: Class "blocks"

Description

A class for overlapped blocks of the time series associated with the given spatial points specified in couples. Thus, it is necessary to execute '>couples first and then '>blocks

Usage

blocks(lb, ls, matdata, pardata1, pardata2, stpairs)

# S4 method for blocks boxplot(x, i, j, ...)

# S4 method for blocks show(object)

# S4 method for blocks [(x, i, j)

# S4 method for blocks summary(object, i, j)

Arguments

lb

integer, length of each block. The number of terms in each block must be greater than 5 and smaller than the quarter part of the length of each time series

ls

integer, number of overlapped data between two consecutive blocks. The number of overlapped terms between two consecutive blocks must in the interval [0, lb/2]

matdata

STFDF/STSDF or data.frame; which contains the coordinates of the spatial points, the identification code of the spatial points, the indentification code of the temporal points and the values of the variable, typically output from dataprep

pardata1

integer, it represents the column in which the spatial ID is stored (if the spatio-temporal data set is given as data.frame) or the number of variables in the STFDF/STSDF (if the data are given as a STFDF/STSDF)

pardata2

integer, it represents the column in which the values of the variable are stored (if the spatio-temporal data set is given as data.frame) or the slot in which the values of the variable of interest are stored (if the data are given as a STFDF/STSDF). Note that for STFDF/STSDF the argument is set, by default, equal to 1 if the number of variables is equal to 1

stpairs

object of class couples, containing the spatial points and the corresponding temporal lags to be analyzed

x

object of class blocks for methods boxplot and extract

i

index specifing the block to be selected. If i=0 all blocks are selected automatically (option available only for boxplot and summary methods)

j

index specifing the spatial point to be selected. If j=0 all spatial points are selected automatically (option available only for boxplot and summary methods)

...

any arguments that will be passed to the panel plotting functions

object

object of class blocks for methods show and summary

Slots

mat.block

matrix of dimension (lb x overall number of blocks); the columns of this matrix are associated with the different blocks, of length equal to lb, that can be extracted from the time series related to the selected spatial points defined in stpairs@sel.staz

array.block

array of dimension (lb x number of blocks for each selected spatial points x number of spatial points). In each table of this array, the overlapped blocks for each spatial location are available

sel.staz

numeric or character; contains the ID codes of the selected spatial points

Details

A message informs the user of the number of blocks computed

References

Li, B., Genton, M.G., Sherman, M., 2007, A nonparametric assessment of properties of spacetime covariance functions. Journal of the American Statistical Association, 102 736--744.

De Iaco, S., Palma, M., Posa, D., 2016. A general procedure for selecting a class of fully symmetric space-time covariance functions. Environmentrics, 27(4) 212--224.

Cappello, C., De Iaco, S., Posa, D., 2018, Testing the type of non-separability and some classes of covariance models for space-time data. Stochastic Environmental Research and Risk Assessment, 32 17--35

See Also

couples

dataprep

Examples

Run this code
# NOT RUN {
# --start define the STFDF rr_13-- #
library(sp)
library(spacetime)
library(gstat)
data(air)
ls()
if (!exists("rural")) rural = STFDF(stations, dates, data.frame(PM10 =
as.vector(air)))
rr = rural[,"2005::2010"]
unsel = which(apply(as(rr, "xts"), 2, function(x) all(is.na(x))))
r5to10 = rr[-unsel,]
rr_13 <- r5to10[c("DEHE046","DESN049","DETH026","DENW063","DETH061","DEBY047",
"DENW065","DEUB029","DENW068","DENI019","DEHE051","DERP016","DENI051"),
"2005::2006"]
# --end define the STFDF rr_13-- #


sel.staz.sym <- c("DERP016", "DENW065", "DEHE051", "DETH026", "DENW063", "DENI019",
"DENW068", "DEHE046", "DEUB029", "DEBY047", "DETH061", "DESN049")

sp.couples.in.sym <- matrix(data = c("DERP016", "DENW065", "DEHE051", "DETH026",
"DENW063", "DENI019", "DENW068", "DEHE046", "DEUB029", "DEBY047", "DETH061", "DESN049"),
ncol = 2, byrow = TRUE)

t.couples.in.sym <- c(1, 2)

couples.sym <- couples(sel.staz = sel.staz.sym, sp.couples.in = sp.couples.in.sym,
t.couples.in = t.couples.in.sym, typetest = "sym", typecode = character())

block.sym <- blocks(lb = 40, ls = 10, matdata = rr_13, pardata1 = 1, pardata2 = 1,
stpairs = couples.sym)

###methods for blocks
#1. show
block.sym

#2. [  extract
block.sym[1,] #select the 1st block of each spatial location
block.sym[,1] #select all blocks of the 1st spatial location
block.sym[1:2, 1:3] #select the first two blocks of the first 3 spatial locations

#3. summary
summary(block.sym, 1:2, 1:3) #to obtain the summary associated to the first
#two blocks of the first 3 spatial locations

summary(block.sym, 0, 1) #to obtain the summary associated to all blocks of
#the 1st spatial location

#4. boxplot
boxplot(block.sym, 1:5, 1:2) #boxplots of the first 5 blocks of associated to
#the first 2 spatial locations

boxplot(block.sym, 0 ,1) #boxplots of all blocks of associated to the 1st
#spatial location

# }

Run the code above in your browser using DataLab