EVOLUTION-MANAGER
Edit File: lines.saddle.distn.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Add a Saddlepoint Approximation to a Plot</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for lines.saddle.distn {boot}"><tr><td>lines.saddle.distn {boot}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Add a Saddlepoint Approximation to a Plot </h2> <h3>Description</h3> <p>This function adds a line corresponding to a saddlepoint density or distribution function approximation to the current plot. </p> <h3>Usage</h3> <pre> ## S3 method for class 'saddle.distn' lines(x, dens = TRUE, h = function(u) u, J = function(u) 1, npts = 50, lty = 1, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>An object of class <code>"saddle.distn"</code> (see <code><a href="saddle.distn.object.html">saddle.distn.object</a></code> representing a saddlepoint approximation to a distribution. </p> </td></tr> <tr valign="top"><td><code>dens</code></td> <td> <p>A logical variable indicating whether the saddlepoint density (<code>TRUE</code>; the default) or the saddlepoint distribution function (<code>FALSE</code>) should be plotted. </p> </td></tr> <tr valign="top"><td><code>h</code></td> <td> <p>Any transformation of the variable that is required. Its first argument must be the value at which the approximation is being performed and the function must be vectorized. </p> </td></tr> <tr valign="top"><td><code>J</code></td> <td> <p>When <code>dens=TRUE</code> this function specifies the Jacobian for any transformation that may be necessary. The first argument of <code>J</code> must the value at which the approximation is being performed and the function must be vectorized. If <code>h</code> is supplied <code>J</code> must also be supplied and both must have the same argument list. </p> </td></tr> <tr valign="top"><td><code>npts</code></td> <td> <p>The number of points to be used for the plot. These points will be evenly spaced over the range of points used in finding the saddlepoint approximation. </p> </td></tr> <tr valign="top"><td><code>lty</code></td> <td> <p>The line type to be used. </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Any additional arguments to <code>h</code> and <code>J</code>. </p> </td></tr> </table> <h3>Details</h3> <p>The function uses <code>smooth.spline</code> to produce the saddlepoint curve. When <code>dens=TRUE</code> the spline is on the log scale and when <code>dens=FALSE</code> it is on the probit scale. </p> <h3>Value</h3> <p><code>sad.d</code> is returned invisibly. </p> <h3>Side Effects</h3> <p>A line is added to the current plot. </p> <h3>References</h3> <p>Davison, A.C. and Hinkley, D.V. (1997) <em>Bootstrap Methods and Their Application</em>. Cambridge University Press. </p> <h3>See Also</h3> <p><code><a href="saddle.distn.html">saddle.distn</a></code> </p> <h3>Examples</h3> <pre> # In this example we show how a plot such as that in Figure 9.9 of # Davison and Hinkley (1997) may be produced. Note the large number of # bootstrap replicates required in this example. expdata <- rexp(12) vfun <- function(d, i) { n <- length(d) (n-1)/n*var(d[i]) } exp.boot <- boot(expdata,vfun, R = 9999) exp.L <- (expdata - mean(expdata))^2 - exp.boot$t0 exp.tL <- linear.approx(exp.boot, L = exp.L) hist(exp.tL, nclass = 50, probability = TRUE) exp.t0 <- c(0, sqrt(var(exp.boot$t))) exp.sp <- saddle.distn(A = exp.L/12,wdist = "m", t0 = exp.t0) # The saddlepoint approximation in this case is to the density of # t-t0 and so t0 must be added for the plot. lines(exp.sp, h = function(u, t0) u+t0, J = function(u, t0) 1, t0 = exp.boot$t0) </pre> <hr /><div style="text-align: center;">[Package <em>boot</em> version 1.3-22 <a href="00Index.html">Index</a>]</div> </body></html>