Learn R Programming

PracTools (version 1.6)

gammaFit: Iteratively estimate variance model parameter \(\gamma\)

Description

Iteratively computes estimate of \(\gamma\) in a model with \(E_M(y)=x^T\beta\) and \(Var_M(y)=\sigma^2x^\gamma\).

Usage

gammaFit(X, x, y, maxiter = 100, show.iter = FALSE, tol = 0.001)

Value

A list with the components:

g.hat

estimate of \(\gamma\) when iterative procedure stopped

converged

TRUE or FALSE depending on whether convergence was obtained

steps

number of steps used by the algorithm

Arguments

X

matrix of predictors in the linear model for y

x

vector of x's for individual units in the assumed specification of \(Var_M(y)\)

y

vector of dependent variables for individual units

maxiter

maximum number of iterations allowed

show.iter

should values of \(\gamma\) be printed of each iteration? TRUE or FALSE

tol

size of relative difference in \(\hat{\gamma}\)'s between consecutive iterations used to determine convergence. Algorithm terminates when relative difference is less than tol.

Author

Richard Valliant, Jill A. Dever, Frauke Kreuter

Details

The function gammaFit estimates the power \(\gamma\) in a model where the variance of the errors is proportional to \(x^\gamma\) for some covariate x. Values of \(\gamma\) are typically in [0,2]. The function calls gamEst.

References

Valliant, R., Dever, J., Kreuter, F. (2018, chap. 3). Practical Tools for Designing and Weighting Survey Samples, 2nd edition. New York: Springer.

See Also

gamEst

Examples

Run this code
data(hospital)
x <- hospital$x
y <- hospital$y

X <- cbind(sqrt(x), x)
gammaFit(X = X, x = x, y = y, maxiter=100, tol=0.002)

Run the code above in your browser using DataLab