Learn R Programming

geoBayes (version 0.3.0)

comparebinlinks: Compare two link functions for the binomial distribution

Description

Compare two link functions for the binomial distribution.

Usage

comparebinlinks(d1, d2, a = -8, b = 8, n = 2001, prob1 = NULL,
  plot = TRUE)

Arguments

d1
Either a positive number of one of "logit" or "probit" defining the link function. If positive number, this corresponds to the robit(d1) link.
d2
Same as d1.
a
Beginning of range of points to evaluate (and plot) the two link functions.
b
End of range of points to evaluate (and plot) the two link functions.
n
Number of points for evaluating (and plot) the two link functions.
prob1
Binomial probabilities corresponding to the first link function.
plot
Whether the two link functions should be plotted. If so, two plots are created: the left plot shows two curves corresponding to the two link functions (black is the first) and the right plot shows their difference (first - second).

Value

  • A list with the following elements
    • scaleThe optimal scalingcsuch thatmax(abs(link(x/c,d1) - link(x,d2)))is minimised forx = seq(a,b,length.out=n)
    • maxdiffThe maximum difference between the two links.
    • prob2The corresponding probabilities fromprob1to the second link.

Details

Finds the closest (after suitable scaling) of the link function d2 to d1. If prob1 is provided, then this corresponds to probabilities under link d1 and the probabilities are transformed to d2. Also creates a plot of the two link functions.

Examples

Run this code
comparebinlinks("logit", 7) # The robit(7) approximates logit
comparebinlinks("probit", 1, prob1 = c(.5, .6, .7, .8, .9))

Run the code above in your browser using DataLab