View source: R/table.pvalues.R
table.pvalues | R Documentation |
Computes the Baysian p-values for the test concerning all coefficients/parameters:
For p = 1,...,P
H_0:θ_{j,k}^{p,q}=0
H_1:θ_{j,k}^{p,q} \neq 0
The two-sided P-value for the sample outcome is obtained by first finding the one sided P-value, min(P(θ_{j,k}^{p,q}<0),P(θ_{j,k}^{p,q}>0 )) which can be estimated from posterior samples. For example, P(θ_{j,k}^{p,q}>0) = \frac{n_+}{n}, where n_+ is the number of posterior samples that are greater than 0, n is the target sample size. The two sided P-value is P_θ(θ_{j,k}^{p,q}) = 2*min(P(θ_{j,k}^{p,q}<0),P(θ_{j,k}^{p,q}>0 )).
If there are θ_{j,k_1}^{p,q},θ_{j,k_2}^{p,q},...,θ_{j,k_J}^{p,q} representing J levels of a multi-level variable, we use a single P-value to represent the significance of all levels. The two alternatives are:
H_0:θ_{j,k_1}^{p,q} = θ_{j,k_2}^{p,q} = \cdots = θ_{j,k_J}^{p,q}=0
H_1 : some θ_{j,k_j}^{p,q} \neq 0
Let θ_{j,k_{min}}^{p,q} and θ_{j,k_{max}}^{p,q} denote the coefficients with the smallest and largest posterior mean. Then the overall P-value is defined as
min(P_θ (θ_{j,k_{min}}^{p,q}), P_θ(θ_{j,k_{max}}^{p,q})).
table.pvalues(x)
x |
the object from BANOVA.* |
It borrows the idea of Sheffe F-test for multiple testing: the F-stat for testing the contrast with maximal difference from zero. Thank Dr. P. Lenk of the University of Michigan for this suggestion.
data(goalstudy) library(rstan) # or use BANOVA.run res1 <- BANOVA.run(bid~progress*prodvar, model_name = "Normal", data = goalstudy, id = 'id', iter = 1000, thin = 1, chains = 2) table.pvalues(res1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.