Learn R Programming

OptimModel (version 2.0-1)

optim_weights: Weight functions for optim_fit

Description

Weight functions for optim_fit. May be used when fit.method=="irwls" or fit.method=="mle". Generally, not called by the user.

Usage

weights_varIdent(phi, mu)
       weights_varExp(phi, mu)
       weights_varPower(phi, mu)
       weights_varConstPower(phi, mu)
       weights_tukey_bw(phi = 4.685, resid)
       weights_huber(phi=1.345, resid)

Value

A vector of numeric weights.

Arguments

phi

Variance parameter(s)

mu

Vector of means

resid

Vector of model residuals

Author

Steven Novick

Details

  • weights_varIdent returns a vector of ones.

  • weights_varExp returns \(\exp(\phi*\mu)\)

  • weights_varPower returns \(|\mu|^{\phi}\)

  • weights_varConstPower returns \(\phi_1 + |\mu|^{\phi_2}\) where \(\phi_i =\phi\)[i]

  • weights_tukey_bw is a Tukey bi-weight function. Let $$r=\tfrac{|\text{resid}|}{\text{mad}(\text{resid},\text{center}=\text{TRUE})}.$$ Then this function returns $$\left(1-\left(\tfrac{r}{\phi}\right)^2\right)^2\text{ whenever } r <= \phi\text{ and }0{ o.w.}$$ For this the user should use phi.fixed=TRUE in the optim_fit function.

  • weights_huber is a Huber weighting function that returns \(\min(1, \phi/r)\), where \(r = |\text{resid}|/\text{sig}\) and \(\text{sig} = \text{mad}(\text{resid}, \text{center} = \text{TRUE})\). For this the user should use phi.fixed = TRUE in the optim_fit function.

See Also

optim_fit, rout_fitter