Learn R Programming

CensSpatial (version 3.6)

rspacens: Censored Spatial data simulation

Description

It simulates spatial data with linear structure for one type of censure (left or right).

Usage

rspacens(cov.pars,beta,x=as.matrix(rep(1,n)),coords,kappa=0,cens,n,n1,
cov.model="exponential",cens.type)

Value

y

complete simulated data (\((n+n1)\) length).

datare

data frame that will be used for the model estimation (coordinates and response).

valre

data that will be used for cross validation studies (just response).

cc

indicator of censure (1:censored 0:observed).

cutoff

limit of detection simulated for censure (left: <=cutoff, right: > cutoff).

coords1

coordinates of value data.

Arguments

cov.pars

covariance structure parameters for the errors distribution (\(\phi, \sigma^2, \tau^2\)).

beta

linear regression parameters.

x

design matrix.

coords

coordinates of simulated data.

kappa

\(\kappa\) parameter used in some covariance structures.

cens

percentage of censure in the data (number between 0 and 1).

n

number of simulated data used in estimation.

n1

number of simulated data used for cross validation (Prediction).

cov.model

covariance structure for the data (see cov.spatial from geoR).

cens.type

type of censure ("left" or "right").

Author

Alejandro Ordonez <<ordonezjosealejandro@gmail.com>>, Victor H. Lachos <<hlachos@ime.unicamp.br>> and Christian E. Galarza <<cgalarza88@gmail.com>>

Maintainer: Alejandro Ordonez <<ordonezjosealejandro@gmail.com>>

Details

This function analyses prediction in spatial data. It returns a spatial dataset for estimation (n length) and a spatial dataset (n1 length) used to evaluate the prediction power of a model through cross validation. The covariance functions used here were provided by cov.spatial from the geoR package.

References

Diggle, P. & Ribeiro, P. (2007). Model-Based Geostatistics. Springer Series in Statistics.

Schelin, L. & Sjostedt-de Luna, S. (2014). Spatial prediction in the presence of left-censoring. Computational Statistics and Data Analysis, 74.

See Also

SAEMSCL

Examples

Run this code

n<-200 ### sample size for estimation.
n1=100 ### number of observation used in the prediction.

###simulated coordinates
r1=sample(seq(1,30,length=400),n+n1)
r2=sample(seq(1,30,length=400),n+n1)
coords=cbind(r1,r2)### total coordinates (used in estimation and prediction).
coords1=coords[1:n,]####coordinates used for estimation.

type="matern"### covariance structure.

xtot<-cbind(1,runif((n+n1)),runif((n+n1),2,3))## X matrix for estimation and prediction.
xobs=xtot[1:n,]## X matrix for estimation

obj=rspacens(cov.pars=c(3,.3,0),beta=c(5,3,1),x=xtot,coords=coords,
kappa=1.2,cens=0.25,n=(n+n1),n1=n1,cov.model=type,cens.type="left")

Run the code above in your browser using DataLab