# residuals.gcmr

##### Quantile Residuals for Gaussian Copula Marginal Regression

Computes various type of quantile residuals for validation of a fitted Gaussian copula marginal regression model, as described in Masarotto and Varin (2012; 2017).

- Keywords
- models, regression

##### Usage

```
# S3 method for gcmr
residuals(object, type=c("conditional","marginal"),
method=c("random","mid"),...)
```

##### Arguments

- object
an object of class

`gcmr`

, typically the result of a call to`gcmr`

.- type
the type of quantile residuals which should be returned. The alternatives are:

`"conditional"`

(default) and`"marginal"`

.- method
different methods available for quantile residuals in case of discrete responses:

`"random"`

for randomized quantile residuals (default), and`"mid"`

for mid interval quantile residuals as defined in Zucchini and MacDonald (2009).- ...
further arguments passed to or from other methods.

##### Details

Quantile residuals are defined in Dunn and Smyth (1996). Two different types are available:

`conditional` |
quantile residuals that account for the dependence. |

Conditional quantile residuals are normal quantiles of Rosenblatt (1952) transformations and they are appropriate for validation of the marginal regression models discussed in Masarotto and Varin (2012; 2017). If the responses are discrete, then the conditional quantile residuals are not well defined. This difficulty is overcame by randomized quantile residuals available through option `method="random"`

. Alternatively, Zucchini and MacDonald (2009) suggest the use of mid interval quantile residuals (`method="mid"`

).

##### Note

Differently from randomized quantile residuals, mid quantile residuals are **not** realizations of incorrelated standard normal variables under model conditions.

It is appropriate to inspect several sets of randomized quantile residuals before to take a decision about the model.

See Masarotto and Varin (2012; 2017) for more details.

##### References

Dunn, P.K. and Smyth, G.K. (1996). Randomized quantile residuals. *Journal of Computational and Graphical Statistics* **5**, 236--244.

Masarotto, G. and Varin, C. (2012). Gaussian copula marginal regression. *Electronic Journal of Statistics* **6**, 1517--1549. http://projecteuclid.org/euclid.ejs/1346421603.

Masarotto, G. and Varin C. (2017). Gaussian Copula Regression in R. *Journal of Statistical Software*, **77**(8), 1--26. 10.18637/jss.v077.i08.

Rosenblatt, M. (1952). Remarks on a multivariate transformation. *The Annals of Mathematical Statistics* **23**, 470--472.

Zucchini, W. and MacDonald, I.L. (2009). *Hidden Markov Models for Time Series*. Chapman and Hall/CRC.

##### See Also

##### Examples

```
# NOT RUN {
## spatial binomial data
# }
# NOT RUN {
data(malaria)
D <- sp::spDists(cbind(malaria$x, malaria$y))/1000
m <- gcmr(cbind(cases, size-cases) ~ netuse+I(green/100)+phc, data=malaria,
marginal=binomial.marg, cormat=matern.cormat(D))
res <- residuals(m)
## normal probability plot
qqnorm(res)
qqline(res)
## or better via plot.gcmr
plot(m, which = 3)
# }
```

*Documentation reproduced from package gcmr, version 1.0.2, License: GPL (>= 2)*