Learn R Programming

highD2pop (version 1.0)

rgammashift: The centered gamma distribution

Description

Random generation for the Gamma distribution with parameters shape and scale centered so as to have mean zero.

Usage

rgammashift(n, shape, scale)

Arguments

n
number of observations to generate.
shape
shape parameter, must be strictly greater than zero.
scale
scale parameter, must be strictly greater than zero.

Value

n of realizations from the centered gamma distribution with shape parameter shape and scale parameter scale.

Examples

Run this code

## The function is currently defined as
function (n, shape, scale) 
{
    x <- rgamma(n = n, shape = shape, scale = scale) - shape*scale
    return(x)
}


x <- rgammashift(500,4,2)

plot(density(x))

Run the code above in your browser using DataLab