Learn R Programming

VGAMextra (version 0.0-1)

rayleighMeanlink: Link functions for the mean of 1--parameter continuous distributions: The Rayleigh and the Maxwell distributions.

Description

The rayleighMeanlink and the maxwellMeanlink transformations, their inverse and the first two derivatives.

Usage

rayleighMeanlink(theta, bvalue = NULL, inverse = FALSE,
                    deriv = 0, short = TRUE, tag = FALSE) 
                    
   maxwellMeanlink(theta, bvalue = NULL, inverse = FALSE,
                   deriv = 0, short = TRUE, tag = FALSE)

Arguments

theta

Numeric or character. It is \(\theta\) by default, but it may be \(\eta\) depending upon other parameters. See Links for further details.

bvalue, inverse, deriv, short, tag

See Links.

Value

For deriv = 0, the corresponding transformation of theta when inverse = FALSE. If inverse = TRUE, then theta becomes \(\eta\), and the inverse transformations

I) exp(theta) * sqrt(2) / gamma(0.5) for rayleighMeanlink, and

II) \(8\) * exp(-2 * theta) / gamma(0.5)\(^2\) for maxwellMeanlink,

are returned.

For deriv = 1, \(d\) eta / \(d\) theta when inverse = FALSE. If inverse = TRUE, then \(d\) theta / \(d\) eta as a function of theta.

When deriv = 2, the second derivatives in terms of theta are returned.

Details

rayleighMeanlink and maxwellMeanlink are link functions to model the mean of the Rayleigh distirbution, (rayleigh), and the mean of the Maxwell distribution, (maxwell), respectively.

Both links are somehow defined as the \( \log {\tt{theta}} \) plus an offset. Specifcally, $$ {\tt{rayleighMeanlink}}(b) = \log ( b * \gamma(0.5) / sqrt{2} ),$$ where \(b > 0\) is a scale parameter as in rayleigh; and $$ {\tt{maxwellhMeanlink}}(b) = \log ( a^{-1/2} * sqrt{8 / \pi} ).$$

Here, \(a\) is positive as in maxwell.

Non--positive values of \(a\) and/or \(b\) will result in NaN, whereas values too close to zero will return Inf or -Inf.

See Also

maxwell, rayleigh Links.

Examples

Run this code
# NOT RUN {
 ##  The link and its inverse ##
    theta <- 0.1 + 1:10
    eta   <- maxwellMeanlink(maxwellMeanlink(theta = theta), inverse  =TRUE)
    summary(eta - theta)     # Zero
    
    eta   <- rayleighMeanlink(rayleighMeanlink(theta = theta), inverse  =TRUE)
    summary(eta - theta)     # Zero


 ## Modelling the mean of the Maxwell distribution  ##
    set.seed(17010401)
    
    rate <- maxwellMeanlink(theta = 2, inverse = TRUE)   # ~ 0.046
    mdata <- data.frame(y = rmaxwell(1000, rate = rate ))
    
    fit <- vglm(y ~ 1, maxwell(link = "maxwellMeanlink"), 
                data = mdata, trace = TRUE, crit = "coef")
    
    coef(fit, matrix = TRUE)
    Coef(fit)
 

# }

Run the code above in your browser using DataLab