DiagStempCens: Diagnostic in spatio-temporal model with censored/missing...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/DiagStempCens.R

Description

Return measures and graphics for diagnostic analysis in spatio-temporal model with censored/missing responses.

Usage

1
DiagStempCens(Est.StempCens, type.diag = "individual", diag.plot = TRUE, ck)

Arguments

Est.StempCens

an object of class Est.StempCens given as output by the EstStempCens function. In the EstStempCensfunction, IMatrix must be TRUE.

type.diag

type of diagnostic: 'individual' is related when one observation is deleted, 'time' is related when an entire time is deleted, 'location' is related when an entire location is deleted and 'all' the three cases ('individual', 'time' and 'location'). By default type.diag is individual.

diag.plot

TRUE or FALSE. It indicates if diagnostic plots must be showed. By default = TRUE.

ck

the value for ck considered in the benchmark value for the index plot: mean(GD)+ck*sd(GD), where GD is the vector with all values of the diagnostic measures.

Details

This function uses the case deletion approach to study the impact of deleting one or more observations from the dataset on the parameters estimates, using the ideas of \insertCitecook1977detection;textualStempCens and \insertCitezhu2001case;textualStempCens. The measure is defined by

GD_i(θ*)=(θ* - θ*[i])'[-Q**(θ|θ*)](θ* - θ*[i]), i=1,....m,

where θ* is the estimate of θ using the complete data, θ*[i] are the estimates obtained after deletion of the i-th observation (or group of observations) and Q**(θ|θ*) is the Hessian matrix.

We can eliminate an observation, an entire location or an entire time index.

Value

The function returns a list with the diagnostic measures.

If type.diag == individual | time | location:

GD is a data.frame with the index value of the observation and the GD measure.

If type.diag == all:

GDind is a data.frame with the index value of the observation and the GD measure for individual.

GDtime is a data.frame with the time index value and the GD measure for time.

GDloc is a data.frame with the side index value and the GD measure for location.

Author(s)

Katherine L. Valeriano, Victor H. Lachos and Larissa A. Matos

See Also

EstStempCens

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## Not run: 
# Initial parameter values
beta <- c(-1,1.5)
phi <- 3;   rho <- 0.40
tau2 <- 1;  sigma2 <- 2
# Simulating data
n1 <- 5    # Number of spatial locations
n2 <- 5    # Number of temporal index
set.seed(98765)
x.co <- round(runif(n1,0,10),9)   # X coordinate
y.co <- round(runif(n1,0,10),9)   # Y coordinate
coord <- cbind(x.co,y.co)         # Cartesian coordinates without repetitions
coord2 <- cbind(rep(x.co,each=n2),rep(y.co,each=n2)) # Cartesian coordinates with repetitions
time <- as.matrix(seq(1,n2))      # Time index without repetitions
time2 <- as.matrix(rep(time,n1))  # Time index with repetitions
x1 <- rexp(n1*n2,2)
x2 <- rnorm(n1*n2,2,1)
x  <- cbind(x1,x2)
media <- x%*%beta
# Covariance matrix
Ms  <- as.matrix(dist(coord))  # Spatial distances
Mt  <- as.matrix(dist(time))   # Temporal distances
Cov <- CovarianceM(phi,rho,tau2,sigma2,Ms,Mt,0,"exponential")
# Data
require(mvtnorm)
y <- as.vector(rmvnorm(1,mean=as.vector(media),sigma=Cov))
perc <- 0.20
aa <- sort(y); bb <- aa[((1-perc)*n1*n2+1):(n1*n2)]; cutof <- bb[1]
cc <- matrix(1,(n1*n2),1)*(y>=cutof)
y[cc==1] <- cutof
y[17] <- abs(y[17])+2*sd(y)
LI <- y
LS <- y; LS[cc==1] <- Inf    # Right-censored

# Estimation
set.seed(74689)
est <- EstStempCens(y, x, cc, time2, coord2, LI, LS, init.phi=2.5, init.rho=0.5, init.tau2=0.8,
          type.Data="balanced", method="nlminb", kappa=0, type.S="exponential",
          IMatrix=TRUE, lower.lim=c(0.01,-0.99,0.01), upper.lim=c(30,0.99,20), M=20,
          perc=0.25, MaxIter=300, pc=0.20)

# Diagnostic
set.seed(12345)
diag <- DiagStempCens(est, type.diag="time", diag.plot = TRUE, ck=1)
## End(Not run)

StempCens documentation built on Oct. 23, 2020, 7:28 p.m.