log_dhurdle_vec_abk: Calculates the mean log probability of a vector of 1-d Hurdle...

Description Usage Arguments Details Value Examples

View source: R/zero_dist.R

Description

Calculates the mean log probability of a vector of 1-d Hurdle random variables under the abk parametrization, each variable with different a and b and shared k.

Usage

1
log_dhurdle_vec_abk(V, Y, A, B, k)

Arguments

V

A logical vector, indicating if each entry in Y is non-zero, i.e. V = (Y != 0).

Y

A numerical vector of i.i.d. 1-d Hurdle random variables.

A

A numerical vector of the same size as V and Y, the a parameters for each sample from Y.

B

A numerical vector of the same size as V and Y, the b parameters for each sample from Y.

k

A positive number, the common k parameter for all samples from Y.

Details

The log probability of a sample y from the 1-d Hurdle model with abk parametrization with respect to the sum of the Lebesgue measure and a point mass at 0 is a*v+b*y-y^2*k/2-log(1+sqrt(2pi/k)*exp(a+b^2/(2k))) where v = (y != 0). The function calculates the mean of the log probabilities over a vector of samples with different a and b parameters and the same k. This is used for the multivariate case where in the conditional 1-d Hurdle model the a and b are functions in other (parent) nodes/variables.

Value

A number, the mean log probability.

Examples

1
2
3
4
5
set.seed(1)
A <- rnorm(100)
B <- rnorm(100)
y <- generate_one_each_a_b_k(A=A, B=B, k=2)
log_dhurdle_vec_abk(y != 0, y, A=A, B=B, k=2)

sqyu/ZiDAG documentation built on Jan. 19, 2021, 4:11 p.m.