# graphResCov.fun: Perform lurking variable plots for a set of variables In NHPoisson: Modelling and Validation of Non Homogeneous Poisson Processes

## Description

This function performs lurking variable plots for a set of variables. The function graphResX.fun performs the lurking variable plot for one variable and graphResCov.fun calls this function for a set of variables; see graphResX.fun for details.

## Usage

 1 2 graphResCov.fun(Xvar, nint, mlePP, h = NULL, typeRes = "Pearson", namX = NULL, histWgraph=TRUE, plotDisp=c(2,2), tit = "") 

## Arguments

 Xvar Matrix of variables (each column is a variable). nint Number of intervals each covariate is divided into to perform the lurking variable plot. mlePP An object of class mlePP-class; usually, the output from fitPP.fun. typeRes Label indicating the type of residuals ("Raw" or any type of scaled residuals such as "Pearson") used in the plots. h Optional. Weight function used to calculate the scaled residuals (if typeRes is not equal to "Raw"). By default, Pearson residuals with h(t)=1/√{\hat λ(t)} are calculated. \hat λ(t) is provided by element lambdafit in mlePP. namX Optional. Vector of the names of the variables in Xvar. histWgraph Logical flag. If it is TRUE, a new graphical device is opened with the option record=TRUE, so that the history of all plots is recorded in the new device. This option may not work on some platforms; for example, RStudio does not allow the user to open new graphical devices. plotDisp A vector of the form c(nr, nc). The lurking variable plots will be drawn in a nr\timesnc array. It is used as argument mfrow in par. By default, a 2 \times 2 window is used. tit Character string. A title for the plot.

## Value

A list with elements

 mXres Matrix of residuals (each column contains the residuals of a variable). mXm Matrix of mean values (each column contains the mean values of a variable in each interval). mXpc Matrix of the quantiles that define the intervals of each variable (each column contains the quantiles of one variable). nint Input argument. mlePP Input argument.

## References

Atkinson, A. (1985). Plots, transformations and regression. Oxford University Press.

Baddeley, A., Turner, R., Moller, J. and Hazelton, M. (2005). Residual analysis for spatial point processes. Journal of the Royal Statistical Society, Series B 67,617-666.

Cebrian, A.C., Abaurrea, J. and Asin, J. (2015). NHPoisson: An R Package for Fitting and Validating Nonhomogeneous Poisson Processes. Journal of Statistical Software, 64(6), 1-24.

graphResX.fun, graphres.fun
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #Simulated process without any relationship with variables Y1 and Y2 #The plots are performed dividing the variables into 50 intervals #Raw residuals. X1<-rnorm(500) X2<-rnorm(500) auxmlePP<-fitPP.fun(posE=round(runif(50,1,500)), inddat=rep(1,500), covariates=cbind(X1,X2),start=list(b0=1,b1=0,b2=0)) Y1<-rnorm(500) Y2<-rnorm(500) res<-graphResCov.fun(mlePP=auxmlePP, Xvar=cbind(Y1,Y2), nint=50, typeRes="Raw",namX=c("Y1","Y2"),plotDisp=c(2,1)) #If more variables were specified in the argument Xvar, with #the same 2X1 layout specified in plotDisp, the resulting plots could be #scrolled up and down with the "Page Up" and "Page Down" keys.