Learn R Programming

modello (version 0.1.1)

ldgamma.modello_number: Gamma Distribution: log-density

Description

Considering a Gamma Distribution calculates the log-density. $$\alpha * log(\beta) - logGamma(\alpha) + (\alpha - 1) log(y) - \beta * y; y > 0$$

Usage

# S3 method for modello_number
ldgamma(y, a, b)

# S3 method for default ldgamma(y, a, b)

ldgamma(y, a, b)

Arguments

y

observations, numeric or reference object of class 'number'

a

shape parameter, numeric of reference object of class 'number'

b

rate parameter, numeric of reference object of class 'number'

Value

Returns a 'numeric' or a reference object of class 'number'

Examples

Run this code
# NOT RUN {
modello.init(10, 10, 10, 10)
## For modello_numbers
y = number(rgamma(10, 5, 4))
ld = ldgamma(y, .k(5), .k(4))
print(ld)
print(ld$v)
modello.close()
## For numerics
y = rgamma(10, 5, 4)
ld = ldgamma(y, 5, 4)
print(ld) 
# }

Run the code above in your browser using DataLab