Learn R Programming

scpm (version 2.0.0)

A1. Create sss data: Convert an object to the class sss for spatial smoothing splines

Description

Create a matrix or data.frame to a valid dataset of class sss for spatial smoothing splines. Those dataset can be used later by functions s2D for tensor product (natural) cubic splines or p-splines, and scp for estimating spatial smoothing splines models.

Usage

as.sss(X, coords, coords.col, data.col, ...)
create.sss(coords, data, ...)
is.sss(x)
sss2df(x)

Arguments

X

a matrix or data-frame. Every row must correspond to a point location in a two-dimensional space (coordinates). Coordinates columns can be included in X or defined separately using the argument coords. Some columns can also correspond to variables measured at the different point locations.

coords

two-columns numeric matrix of coordinates (optional).

data

a data-frame containing the variables measured at the locations given by coords.

coords.col

numeric vector. The number of columns in X that contains the coordinates.

data.col

numeric vector. The number of columns in X that contains variables measured at the points locations.

slots elements to create a new sss dataset. Required slots are data, coords, grid, knots, W, contract (to be discarded in the future), and regular. See Value for an explanation about each slot requirements.

x

an object to check validity as member of class sss.

Value

data

a data-frame containing the variables measured at the locations given by coords.

coords

a matrix containing the two columns of observed coordinates for the data.

grid

a grid matrix containing the two columns of coordinates.

knots

a named list with the design points (knots) in every coordinate. Equivalent to a grid.list object.

W

a spatial incidence matrix. If contract=TRUE it is \(W_{ij}\), otherwise \(W_{ji}\).

contract

logical. The same value as the argument contract.

regular

logical. If the coordinates are observed at regular points it is TRUE, FALSE otherwise (missing coordinates in any direction).