ldnorm: Normal Distribution: log-density

Description Usage Arguments Value Author(s) Examples

Description

Considering a Normal Distribution calculates the log-density

ld = -log(σ) - 0.5 * log(2 * π) - 0.5 * ((y - μ) / σ)^2

Usage

1
2
3
4
5
6
7
## S3 method for class 'modello_number'
ldnorm(y, mu, s)

## Default S3 method:
ldnorm(y, mu, s)

ldnorm(y, mu, s)

Arguments

y

observations, numeric or reference object of class 'number'

mu

mean, numeric of reference object of class 'number'

s

standard deviation, numeric of reference object of class 'number'

Value

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

Author(s)

Filippo Monari

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
modello.init(10, 10, 10, 10)
## For modello_numbers
y = number(rnorm(10))
ld = ldnorm(y, .k(0), .k(1))
print(ld)
print(ld$v)
modello.close()
## For numerics
y = rnorm(10)
ld = ldnorm(y, 0, 1)
print(ld) 

modello documentation built on Feb. 2, 2021, 9:06 a.m.

Related to ldnorm in modello...