View source: R/EstSAEMspatial_USER.R
SAEM.sclm | R Documentation |
It fits the left, right, or interval spatial censored linear model using the Stochastic Approximation EM (SAEM) algorithm. It provides estimates and standard errors of the parameters and supports missing values on the dependent variable.
SAEM.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 = 300, M = 20, pc = 0.2, 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 of the SAEM algorithm. By default |
M |
number of Monte Carlo samples for stochastic approximation. By default |
pc |
percentage of initial iterations of the SAEM algorithm with no memory.
It is recommended that |
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 full rank \insertCitediggle2007springerRcppCensSpatial.
The estimation process is performed via the SAEM algorithm, initially proposed by
\insertCitedelyon1999convergence;textualRcppCensSpatial. The spatial censored
(SAEM) algorithm was previously proposed by \insertCitelachos2017influence;textualRcppCensSpatial and
\insertCiteordonez2018geostatistical;textualRcppCensSpatial and is available in the package CensSpatial
.
These packages differ in the random number generation and optimization procedure.
This model is also a particular case of the spatio-temporal model defined by
\insertCitevaleriano2021likelihood;textualRcppCensSpatial when the number of
temporal observations is equal to one. The computing codes of the spatio-temporal
SAEM algorithm are available in the package StempCens
.
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 |
stochastic approximation of the first conditional moment. |
EYY |
stochastic approximation of the second conditional moment. |
SE |
vector of standard errors of θ = (β, σ^2, φ, τ^2). |
InfMat |
observed information matrix. |
loglik |
log-likelihood for the SAEM 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 SAEM algorithm. |
The SAEM final estimates correspond to the estimates obtained at the last iteration of the algorithm.
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
, MCEM.sclm
, predict.sclm
# Example 1: 8% of right-censored observations 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(4,-2), 1, 3, 0.50, x, coords, "right", 0.08) fit = SAEM.sclm(y=data$y, x=x, ci=data$ci, lcl=data$lcl, ucl=data$ucl, coords, phi0=2, nugget0=1, type="exponential", M=10, pc=0.18) fit # Example 2: censored and missing observations set.seed(123) n = 200 coords = round(matrix(runif(2*n,0,20),n,2), 5) x = cbind(runif(n), rnorm(n), rexp(n)) data = rCensSp(c(1,4,-1), 2, 3, 0.50, x, coords, "left", 0.05, 0, "matern", 3) data$y[c(10,120)] = NA data$ci[c(10,120)] = 1 data$ucl[c(10,120)] = Inf fit2 = SAEM.sclm(y=data$y, x=x, ci=data$ci, lcl=data$lcl, ucl=data$ucl, coords, phi0=2, nugget0=1, type="matern", kappa=3, M=10, pc=0.18) fit2$tab plot(fit2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.