sum_b: Calculate the b parameter in the conditional Hurdle density...

Description Usage Arguments Details Value Examples

View source: R/zero_dist.R

Description

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

Usage

1
sum_b(bb, vo, yo, minus_Y = TRUE)

Arguments

bb

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).

minus_Y

A logical, see details.

Details

Assuming bb = c(b1, b2, b3) where b1 is a scalar, b2 and b3, the function returns b1 + sum(b2*vo) - sum(b3*yo) if minus_Y == TRUE, otherwise b1 + sum(b2*vo) + sum(b3*yo). This is used for calculating the a parameter of the conditional Hurdle density of the child node given the parent nodes, assuming the b 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_b(stats::rnorm(201), vo, yo, minus_Y=TRUE)

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