# residuals.simplexreg: Extract residuals for simplexreg Objects In simplexreg: Regression Analysis of Proportional Data Using Simplex Distribution

## Description

Methods for extracting various types of residuals from simplex regression, from approximate Pearson residuals, standard Pearson residuals and standardise score residuals to adjusted dependent variable suggested by McCullagh and Nelder (1989). The first three can be used to examine mean-variance relation while the last aims to test the link function.

## Usage

 ```1 2 3``` ```## S3 method for class 'simplexreg' residuals(object, type = c("appstdPerr", "stdPerr", "stdscor", "adjvar"), ...) ```

## Arguments

 `object` fitted model object of class "simplexreg" `type` character specifying types of residuals:approximate Pearson residual (`appstdPerr`), standard Pearson residual (`stdPerr`), adjusted dependent variable s_i (`adjvar`). Details are given in 'Details' `...` currently not used

## Details

The Pearson residual takes the form

r_i^P=(y_i-μ_i)/(τ_i)

where μ_i is the fitted mean parameter and details about calculation of τ is given in Jorgensen (1997). When the dispersion parameter σ^2 (see `simplex`) is large the variance of response approaches to μ(1-μ) and this leads to the approximate Pearson residual

r_i^P=(y_i-μ_i)/√{(μ_i(1-μ_i))}

Plot of the standardised score residuals,

r_i^S=u_i/ √{var(u_i)}

where u_i is the score function, can also detect model assumption violation. Details can be found in Song et al. (2004). The adjusted dependent variable suggested by McCullagh and Nelder (1989) could be employed as an informal check for the link function,

s_i = g(μ_i) + {3σ^4 / (μ_i(1-μ_i)) + √{σ^2 / V(μ_i)}} u(y_i;μ_i)

where u(y_i;μ_i) and V(μ_i) are the score function and variance function.

Chengchun Shi

## References

Barndorff-Nielsen, O.E. and Jorgensen, B. (1991) Some parametric models on the simplex. Journal of Multivariate Analysis, 39: 106–116

Jorgensen, B. (1997) The Theory of Dispersion Models. London: Chapman and Hall

McCullagh, P and Nelder J. (1989) Generalized Linear Models. London: Chapman and Hall

Song, P. and Qiu, Z. and Tan, M. (2004) Modelling Heterogeneous Dispersion in Marginal Models for Longitudinal Proportional Data. Biometrical Journal, 46: 540–553

Zhang, P. and Qiu, Z. and Shi, C. (2016) simplexreg: An R Package for Regression Analysis of Proportional Data Using the Simplex Distribution. Journal of Statistical Software, 71: 1–21

`summary.simplexreg`, `simplex`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```## fit the model data("sdac", package="simplexreg") sim.glm2 <- simplexreg(rcd~ageadj+chemo|age, link = "logit", data = sdac) data("retinal", package = "simplexreg") sim.gee2 <- simplexreg(Gas~LogT+LogT2+Level|LogT+Level|Time, link = "logit", corr = "AR1", id = ID, data = retinal) ## extract the residuals res <- residuals(sim.glm2, type = "stdPerr") res <- residuals(sim.gee2, type = "adjvar") ```