sum_B_mat: 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 multiple samples, assuming b is linear in the parents and their indicators.

Usage

1
sum_B_mat(bb, Vo, Yo, minus_Y = TRUE)

Arguments

bb

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

Vo

A numerical vector of the same dimension 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 in sum_b().

Details

Matrix version of sum_b(). See examples.

Value

A number, the mean log probability.

Examples

1
2
3
4
5
6
set.seed(1)
n <- 100; p_others <- 10
Vo <- matrix(stats::rbinom(n*p_others, 1, 0.8), nrow=n, ncol=p_others)
Yo <- matrix(stats::rnorm(n*p_others) * Vo, nrow=n, ncol=p_others)
bb <- rnorm(2*p_others+1)
sum_B_mat(bb, Vo, Yo) - sapply(1:n, function(i){sum_b(bb, Vo[i,], Yo[i,])})

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