View source: R/finalfunctionDiag.R
| InfDiag | R Documentation | 
It performs influence diagnostic by a local influence approach \insertCitecook1986assessmentARCensReg with three possible perturbation schemes: response perturbation (y), scale matrix perturbation (Sigma), or explanatory variable perturbation (x). A benchmark value is calculated that depends on k.
InfDiag(object, k = 3, indpar = rep(1, length(object$theta)), 
  indcolx = rep(1, ncol(object$x)), perturbation = "y")
| object | Object of class  | 
| k | Constant to be used in the benchmark calculation:  | 
| indpar | Vector of length equal to the number of parameters, with each element 0 or 1 indicating if the respective parameter should be considered in the influence calculation. | 
| indcolx | If  | 
| perturbation | Perturbation scheme. Possible values: "y" for response perturbation, "Sigma" for scale matrix perturbation, or "x" for explanatory variable perturbation. | 
The function returns a vector of length n with the aggregated contribution (M0) of all eigenvectors 
of the matrix associated with the normal curvature. For details see \insertCiteschumacher2018influence;textualARCensReg.
An object of class "DiagARpCRM" with the following components is returned:
| M0 | Vector of length  | 
| perturbation | Perturbation scheme. | 
| benchmark | 
 | 
Fernanda L. Schumacher, Katherine L. Valeriano, Victor H. Lachos, Christian E. Galarza, and Larissa A. Matos
cook1986assessmentARCensReg
\insertRefschumacher2018influenceARCensReg
\insertRefzhu2001localARCensReg
ARCensReg
library(ggplot2)
# Generating the data
set.seed(12341)
x = cbind(1,runif(100))
dat = rARCens(n=100, beta=c(1,-1), phi=c(.48,-.2), sig2=.5, x=x, 
              cens='left', pcens=.05)
              
# Creating an outlier
dat$data$y[40] = 5
ggplot(dat$data) + geom_line(aes(x=1:100, y=y)) + theme_bw() +
  labs(x="Time")
# Fitting the model
fit = ARCensReg(dat$data$cc, dat$data$lcl, dat$data$ucl, dat$data$y, x, 
                p=2, tol=0.001, show_se=FALSE)
# Influence diagnostic
M0y = InfDiag(fit, k=3.5, perturbation="y")
plot(M0y)
M0Sigma = InfDiag(fit, k=3.5, perturbation="Sigma")
plot(M0Sigma)
M0x = InfDiag(fit, k=3.5, indcolx=c(0,1), perturbation="x")
plot(M0x)
# Perturbation on a subset of parameters
M0y1 = InfDiag(fit, k=3.5, indpar=c(1,1,0,0,0), perturbation="y")$M0
M0y2 = InfDiag(fit, k=3.5, indpar=c(0,0,1,1,1), perturbation="y")$M0
#
ggplot(data.frame(M0y1,M0y2)) + geom_point(aes(x=M0y1, y=M0y2)) +
  geom_hline(yintercept=mean(M0y2)+3.5*sd(M0y2), linetype="dashed") +
  geom_vline(xintercept=mean(M0y1)+3.5*sd(M0y1), linetype="dashed") +
  theme_bw()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.