EVOLUTION-MANAGER
Edit File: rTweedie.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: Generate Tweedie random deviates</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 rTweedie {mgcv}"><tr><td>rTweedie {mgcv}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Generate Tweedie random deviates</h2> <h3>Description</h3> <p> Generates Tweedie random deviates, for powers between 1 and 2. </p> <h3>Usage</h3> <pre> rTweedie(mu,p=1.5,phi=1) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>mu</code></td> <td> <p>vector of expected values for the deviates to be generated. One deviate generated for each element of <code>mu</code>.</p> </td></tr> <tr valign="top"><td><code>p</code></td> <td> <p>the variance of a deviate is proportional to its mean, <code>mu</code> to the power <code>p</code>. <code>p</code> must be between 1 and 2. 1 is Poisson like (exactly Poisson if <code>phi=1</code>), 2 is gamma. </p> </td></tr> <tr valign="top"><td><code>phi</code></td> <td> <p>The scale parameter. Variance of the deviates is given by is <code>phi*mu^p</code>.</p> </td></tr> </table> <h3>Details</h3> <p> A Tweedie random variable with 1<p<2 is a sum of <code>N</code> gamma random variables where <code>N</code> has a Poisson distribution, with mean <code>mu^(2-p)/((2-p)*phi)</code>. The Gamma random variables that are summed have shape parameter <code>(2-p)/(p-1)</code> and scale parameter <code>phi*(p-1)*mu^(p-1)</code> (note that this scale parameter is different from the scale parameter for a GLM with Gamma errors). </p> <p>This is a restricted, but faster, version of <code>rtweedie</code> from the <code>tweedie</code> package. </p> <h3>Value</h3> <p> A vector of random deviates from a Tweedie distribution, expected value vector <code>mu</code>, variance vector <code>phi*mu^p</code>. </p> <h3>Author(s)</h3> <p> Simon N. Wood <a href="mailto:simon.wood@r-project.org">simon.wood@r-project.org</a> </p> <h3>References</h3> <p>Peter K Dunn (2009). tweedie: Tweedie exponential family models. R package version 2.0.2. <a href="https://cran.r-project.org/package=tweedie">https://cran.r-project.org/package=tweedie</a> </p> <h3>See Also</h3> <p><code><a href="ldTweedie.html">ldTweedie</a></code>, <code><a href="Tweedie.html">Tweedie</a></code></p> <h3>Examples</h3> <pre> library(mgcv) f2 <- function(x) 0.2 * x^11 * (10 * (1 - x))^6 + 10 * (10 * x)^3 * (1 - x)^10 n <- 300 x <- runif(n) mu <- exp(f2(x)/3+.1);x <- x*10 - 4 y <- rTweedie(mu,p=1.5,phi=1.3) b <- gam(y~s(x,k=20),family=Tweedie(p=1.5)) b plot(b) </pre> <hr /><div style="text-align: center;">[Package <em>mgcv</em> version 1.8-28 <a href="00Index.html">Index</a>]</div> </body></html>