View source: R/EstMCEMspatial_USER.R
MCEM.sclm | R Documentation |
It fits the left, right, or interval spatial censored linear model using the Monte Carlo EM (MCEM) algorithm. It provides estimates and standard errors of the parameters and supports missing values on the dependent variable.
MCEM.sclm(y, x, ci, lcl = NULL, ucl = NULL, coords, phi0, nugget0, type = "exponential", kappa = NULL, lower = c(0.01, 0.01), upper = c(30, 30), MaxIter = 500, nMin = 20, nMax = 5000, error = 1e-04, show_se = TRUE)
y |
vector of responses of length n. |
x |
design matrix of dimensions n\times q, where q is the number of fixed effects, including the intercept. |
ci |
vector of censoring indicators of length n. For each observation:
|
lcl, ucl |
vectors of length n representing the lower and upper bounds
of the interval, which contains the true value of the censored observation. Default
|
coords |
2D spatial coordinates of dimensions n\times 2. |
phi0 |
initial value for the spatial scaling parameter. |
nugget0 |
initial value for the nugget effect parameter. |
type |
type of spatial correlation function: |
kappa |
parameter for some spatial correlation functions. See |
lower, upper |
vectors of lower and upper bounds for the optimization method.
If unspecified, the default is |
MaxIter |
maximum number of iterations for the MCEM algorithm. By default |
nMin |
initial sample size for Monte Carlo integration. By default |
nMax |
maximum sample size for Monte Carlo integration. By default |
error |
maximum convergence error. By default |
show_se |
logical. It indicates if the standard errors
should be estimated by default |
The spatial Gaussian model is given by
Y = Xβ + ξ,
where Y is the n\times 1 response vector, X is the n\times q design matrix, β is the q\times 1 vector of regression coefficients to be estimated, and ξ is the error term. Which is normally distributed with zero-mean and covariance matrix Σ=σ^2 R(φ) + τ^2 I_n. We assume that Σ is non-singular and X has a full rank \insertCitediggle2007springerRcppCensSpatial.
The estimation process is performed via the MCEM algorithm, initially proposed by
\insertCitewei1990monte;textualRcppCensSpatial. The Monte Carlo (MC) approximation starts
with a sample of size nMin
; at each iteration, the sample size increases (nMax-nMin
)/MaxIter
,
and at the last iteration, the sample size is nMax
. The random observations are sampled through the slice
sampling algorithm available in package relliptical
.
An object of class "sclm". Generic functions print
and summary
have methods to show the results of the fit. The function plot
can extract
convergence graphs for the parameter estimates.
Specifically, the following components are returned:
Theta |
estimated parameters in all iterations, θ = (β, σ^2, φ, τ^2). |
theta |
final estimation of θ = (β, σ^2, φ, τ^2). |
beta |
estimated β. |
sigma2 |
estimated σ^2. |
phi |
estimated φ. |
tau2 |
estimated τ^2. |
EY |
MC approximation of the first conditional moment. |
EYY |
MC approximation of the second conditional moment. |
SE |
vector of standard errors of θ = (β, σ^2, φ, τ^2). |
InfMat |
observed information matrix. |
loglik |
log-likelihood for the MCEM method. |
AIC |
Akaike information criterion. |
BIC |
Bayesian information criterion. |
Iter |
number of iterations needed to converge. |
time |
processing time. |
call |
|
tab |
table of estimates. |
critFin |
selection criteria. |
range |
effective range. |
ncens |
number of censored/missing observations. |
MaxIter |
maximum number of iterations for the MCEM algorithm. |
The MCEM final estimates correspond to the mean of the estimates obtained at each iteration after deleting the half and applying a thinning of 3.
To fit a regression model for non-censored data, just set ci
as a vector of zeros.
Katherine L. Valeriano, Alejandro Ordoñez, Christian E. Galarza, and Larissa A. Matos.
EM.sclm
, SAEM.sclm
, predict.sclm
# Example 1: left censoring data set.seed(1000) n = 50 # Test with another values for n coords = round(matrix(runif(2*n,0,15),n,2), 5) x = cbind(rnorm(n), rnorm(n)) data = rCensSp(c(2,-1), 2, 3, 0.70, x, coords, "left", 0.08, 0, "matern", 1) fit = MCEM.sclm(y=data$y, x=x, ci=data$ci, lcl=data$lcl, ucl=data$ucl, coords, phi0=2.50, nugget0=0.75, type="matern", kappa=1, MaxIter=30, nMax=1000) fit$tab # Example 2: left censoring and missing data yMiss = data$y yMiss[20] = NA ci = data$ci ci[20] = 1 ucl = data$ucl ucl[20] = Inf fit1 = MCEM.sclm(y=yMiss, x=x, ci=ci, lcl=data$lcl, ucl=ucl, coords, phi0=2.50, nugget0=0.75, type="matern", kappa=1, MaxIter=300, nMax=1000) summary(fit1) plot(fit1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.