Learn R Programming

xactonomial (version 1.0.3)

calc_prob_null: Calculate probability for given parameters

Description

Given a set of candidate parameter vectors, the enumerated sample space, and a logical vector with the same number of elements of the sample space, compute the probability for each element of the sample space and take the sum.

Usage

calc_prob_null(theta_cands, SSpacearr, logC, II)

Value

A numeric vector of probabilities

Arguments

theta_cands

A matrix with samples in the rows and the parameters in the columns

SSpacearr

A matrix with the sample space for the given size of the problem

logC

log multinomial coefficient for each element of the sample space

II

logical vector of sample space psi being more extreme than the observed psi

Examples

Run this code
sspace_3_5 <- matrix(sspace_multinom(3, 5), ncol = 3, byrow = TRUE)
theta_cands <- matrix(sample_unit_simplexn(3, 10), ncol = 3,byrow = TRUE)
calc_prob_null_fast(theta_cands, sspace_3_5,
apply(sspace_3_5, 1, log_multinom_coef, sumx = 5), II = 1:21 > 12)
# same as below but faster
calc_prob_null(theta_cands, sspace_3_5,
apply(sspace_3_5, 1, log_multinom_coef, sumx = 5), II = 1:21 > 12)

Run the code above in your browser using DataLab