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

Density, distribution function, quantile function and random generation for the Tobit model.

1 2 3 4 5 6 |

`x, q` |
vector of quantiles. |

`p` |
vector of probabilities. |

`n` |
number of observations.
If |

`Lower, Upper` |
vector of lower and upper thresholds. |

`mean, sd, lower.tail, log, log.p` |
see |

See `tobit`

, the VGAM family function
for estimating the parameters,
for details.
Note that the density at `Lower`

and `Upper`

is the
the area to the left and right of those points.
Thus there are two spikes (but less in value); see the example below.
Consequently, `dtobit(Lower) + dtobit(Upper) + `

the area
in between equals unity.

`dtobit`

gives the density,
`ptobit`

gives the distribution function,
`qtobit`

gives the quantile function, and
`rtobit`

generates random deviates.

T. W. Yee

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 | ```
mu <- 0.5; x <- seq(-2, 4, by = 0.01)
Lower <- -1; Upper <- 2.0
integrate(dtobit, lower = Lower, upper = Upper,
mean = mu, Lower = Lower, Upper = Upper)$value +
dtobit(Lower, mean = mu, Lower = Lower, Upper = Upper) +
dtobit(Upper, mean = mu, Lower = Lower, Upper = Upper) # Adds to unity
## Not run:
plot(x, ptobit(x, m = mu, Lower = Lower, Upper = Upper),
type = "l", ylim = 0:1, las = 1, col = "orange",
ylab = paste("ptobit(m = ", mu, ", sd = 1, Lower =", Lower,
", Upper =", Upper, ")"),
main = "Orange is cumulative distribution function; blue is density",
sub = "Purple lines are the 10,20,...,90 percentiles")
abline(h = 0)
lines(x, dtobit(x, m = mu, Lower = Lower, Upper = Upper), col = "blue")
probs <- seq(0.1, 0.9, by = 0.1)
Q <- qtobit(probs, m = mu, Lower = Lower, Upper = Upper)
lines(Q, ptobit(Q, m = mu, Lower = Lower, Upper = Upper),
col = "purple", lty = "dashed", type = "h")
lines(Q, dtobit(Q, m = mu, Lower = Lower, Upper = Upper),
col = "darkgreen", lty = "dashed", type = "h")
abline(h = probs, col = "purple", lty = "dashed")
max(abs(ptobit(Q, m = mu, Lower = Lower, Upper = Upper) - probs)) # Should be 0
endpts <- c(Lower, Upper) # Endpoints have a spike (not quite, actually)
lines(endpts, dtobit(endpts, m = mu, Lower = Lower, Upper = Upper),
col = "blue", lwd = 3, type = "h")
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.