Learn R Programming

VGAM (version 1.0-5)

cardioid: Cardioid Distribution Family Function

Description

Estimates the two parameters of the cardioid distribution by maximum likelihood estimation.

Usage

cardioid(lmu = extlogit(min = 0, max = 2*pi),
         lrho = extlogit(min = -0.5, max = 0.5),
         imu = NULL, irho = 0.3, nsimEIM = 100, zero = NULL)

Arguments

lmu, lrho

Parameter link functions applied to the \(\mu\) and \(\rho\) parameters, respectively. See Links for more choices.

imu, irho

Initial values. A NULL means an initial value is chosen internally. See CommonVGAMffArguments for more information.

nsimEIM, zero

See CommonVGAMffArguments for more information.

Value

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm, rrvglm and vgam.

Warning

Numerically, this distribution can be difficult to fit because of a log-likelihood having multiple maximums. The user is therefore encouraged to try different starting values, i.e., make use of imu and irho.

Details

The two-parameter cardioid distribution has a density that can be written as $$f(y;\mu,\rho) = \frac{1}{2\pi} \left(1 + 2\, \rho \cos(y - \mu) \right) $$ where \(0 < y < 2\pi\), \(0 < \mu < 2\pi\), and \(-0.5 < \rho < 0.5\) is the concentration parameter. The default link functions enforce the range constraints of the parameters.

For positive \(\rho\) the distribution is unimodal and symmetric about \(\mu\). The mean of \(Y\) (which make up the fitted values) is \(\pi + (\rho/\pi) ((2 \pi-\mu) \sin(2 \pi-\mu) + \cos(2 \pi-\mu) - \mu \sin(\mu) - \cos(\mu))\).

References

Jammalamadaka, S. R. and SenGupta, A. (2001) Topics in Circular Statistics, Singapore: World Scientific.

See Also

rcard, extlogit, vonmises.

CircStats and circular currently have a lot more R functions for circular data than the VGAM package.

Examples

Run this code
# NOT RUN {
cdata <- data.frame(y = rcard(n = 1000, mu = 4, rho = 0.45))
fit <- vglm(y ~ 1, cardioid, data = cdata, trace = TRUE)
coef(fit, matrix=TRUE)
Coef(fit)
c(with(cdata, mean(y)), head(fitted(fit), 1))
summary(fit)
# }

Run the code above in your browser using DataLab