# rstudents: Studentized Residuals from a Nonlinear Model In genomaths/usefr: Utility Functions for Statistical Analyses

 rstudents R Documentation

## Studentized Residuals from a Nonlinear Model

### Description

Given a fitted model and additional information, this function computes the corresponding internally studentized residuals.

### Usage

``````rstudents(model, varobj, method = c("Richardson", "simple", "complex"), ...)

## S4 method for signature 'missingORNULL'
rstudents(
model,
varobj,
method = c("Richardson", "simple", "complex"),
pars,
fun,
residuals
)

## S4 method for signature 'nls'
rstudents(
model,
varobj,
method = c("Richardson", "simple", "complex"),
residuals = NULL
)

## S4 method for signature 'CDFmodel'
rstudents(
model,
varobj,
method = c("Richardson", "simple", "complex"),
residuals = NULL
)

## S4 method for signature 'nls.lm'
rstudents(
model,
varobj,
method = c("Richardson", "simple", "complex"),
fun,
residuals = NULL
)
``````

### Arguments

 `model` An object from the ""nls" class. It can be derived. e.g., from function `nls` or `nlsLM` from the R packages stats and minpack.lm, respectively. `varobj` Objective variable used build the model. `method` Argument for `grad` function from numDeriv package. One of "Richardson", "simple", or "complex" indicating the method to use for the approximation. `pars` model parameters. `fun` The named expression (not a character string) of the fitted model. For example, the normal distribution function is given by pnorm (see ?pnorm). `residuals` Residuals from the model fitting.

### Details

If the model argument is provided, then only the argument varobj are required. The internally studentized residuals are computed as `t = residuals/(s * sqrt(1 - h))`, where `h` is the diagonal of the hat matrix and `s` is the estimation of the residual variation ((see Wikipedia)).

If the hat matrix cannot be estimated, the standardized residual are estimated as equal to the value of a residual, divided by an estimation of its standard deviation, i.e., `t = residuals/s`.

Studentized/Standardized residuals greater than 2 and less than -2 are usually considered large.

### Value

A vector of studentized residuals when model is missing, NULL, or "nls" class object. If `model="CDFmodel`, then it will update the information carried on model\$rstudent and the model will be returned.

genomaths/usefr documentation built on April 18, 2023, 3:35 a.m.