geometricffMeanlink: Link functions for the mean of 1-parameter discrete...

Description Usage Arguments Details Value Warning Note Author(s) See Also Examples

Description

Computes the geometricffMlink transformation, including its inverse and the first two derivatives.

Usage

1
2
    geometricffMlink(theta, bvalue = NULL, inverse = FALSE, 
                     deriv = 0, short = TRUE, tag = FALSE)

Arguments

theta

Numeric or character. See below for further details.

bvalue, inverse, deriv, short, tag

Details at Links

Details

This is a natural link function to model the mean of the (discret) geometric distribution, geometric, defined as the logarithmm of its mean, i.e.,

η = - log (prob / (1 - prob)) = -logit(prob).

Here, prob is the probability of succes, as in geometric.

While this link function can be used to model any parameter lying in (0, 1), it is particularly useful for event-rate geometric data where the mean can be written in terms of some rate of events, say λ(x), as

μ = λ(x) t ,

and the time t (as log(t)) can be easily incorporated in the analysis as an offset.

Under this link function the domain set for prob is (0, 1). Hence, values of rho too close to the extremes, or out of range will result in Inf, -Inf, NA or NaN. Use argument bvalue to adequately replace them before computing the link function.

If theta is a character, arguments inverse and deriv are disregarded.

Value

For deriv = 0, the geometricffMlink transformation of theta when inverse = FALSE. When inverse = TRUE then theta becomes η, and exp(-theta) / (exp(-theta) - 1) is returned.

For deriv = 1, d eta / d theta, if inverse = FALSE, else the reciprocal d theta / d eta as a function of theta.

For deriv = 2 the second order derivatives are correspondingly returned.

Warning

Numerical instability may occur if covariates are used leading to values of prob out of range. Try to overcome this by using argument bvalue.

Note

This function may return Inf of -Inf for values of prob too close to 0 and 1 respectively.

Author(s)

V. Miranda and T. W. Yee

See Also

geometric, Links, logitlink, logffMlink.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
### Example 1  ###
my.probs <- ppoints(100)
geol.inv <-
    geometricffMlink(theta = geometricffMlink(theta = my.probs), # the inverse
                                inverse = TRUE) - my.probs
summary(geol.inv)     ## zero

###  Example 2. Special values of 'prob'  ###
my.probs <- c(-Inf, -2, -1, 0, 0.25, 0.75, 1.0, 5, Inf, NaN, NA) 
rbind(probs = my.probs, 
      geoffMlink = geometricffMlink(theta = my.probs),
      inv.geoffl = geometricffMlink(theta = my.probs, inverse = TRUE))


###  Example 3 Some probability link functions  ###


my.probs <- ppoints(100)

par(lwd = 2)
plot(my.probs, logitlink(my.probs), xlim = c(-0.1, 1.1), ylim = c(-5, 8),
     type = "l", col = "limegreen", 
     ylab = "transformation", las = 1, main = "Some probability link functions")
lines(my.probs, geometricffMlink(my.probs), col = "gray50")
lines(my.probs, logffMlink(my.probs), col = "blue")
lines(my.probs, probitlink(my.probs), col = "purple")
lines(my.probs, clogloglink(my.probs), col = "chocolate")
lines(my.probs, cauchitlink(my.probs), col = "tan")
abline(v = c(0.5, 1), lty = "dashed")
abline(v = 0, h = 0, lty = "dashed")
legend(0.1, 8, 
      c("geometricffMlink", "logffMlink","logitlink", "probitlink",
      "clogloglink", "cauchitlink"), 
      col = c("gray50", "blue", "limegreen", "purple", "chocolate", "tan"),
      lwd = 1, cex = 0.5)
par(lwd = 1) 
 

VGAMextra documentation built on May 24, 2021, 9:07 a.m.