sum_a: Calculate the a parameter in the conditional Hurdle density...

Description Usage Arguments Details Value Examples

View source: R/zero_dist.R

Description

Calculate the a parameter in the conditional Hurdle density of the child node given the parents for one sample, assuming a is linear in the parents and their indicators.

Usage

1
sum_a(aa, vo, yo)

Arguments

aa

A numerical vector of length 2*length(yo)+1. See details.

vo

A numerical vector of the same length as yo indicating if each entry in yo is non-zero, i.e. vo = (yo != 0).

yo

A numerical vector, a sample for the parent nodes (regressors).

Details

Assuming aa = c(a1, a2, a3) where a1 is a scalar, a2 and a3, the function returns a1 + sum(a2*vo) + sum(a3*yo). This is used for calculating the a parameter of the conditional Hurdle density of the child node given the parent nodes, assuming the a parameter is linear in the parents and their indicators.

Value

A number, the mean log probability.

Examples

1
2
3
4
set.seed(1)
vo <- stats::rbinom(100, 1, 0.8)
yo <- stats::rnorm(100) * vo
sum_a(stats::rnorm(201), vo, yo)

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