Learn R Programming

BANOVA (version 1.2.1)

table.pvalues: Function to print the table of p-values

Description

Computes the Baysian p-values for the test concerning all coefficients/parameters:

For \(p = 1,...,P\) \(H_0:\theta_{j,k}^{p,q}=0\) \(H_1:\theta_{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(\theta_{j,k}^{p,q}<0),P(\theta_{j,k}^{p,q}>0 ))\) which can be estimated from posterior samples. For example, \(P(\theta_{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_\theta(\theta_{j,k}^{p,q}) = 2*min(P(\theta_{j,k}^{p,q}<0),P(\theta_{j,k}^{p,q}>0 ))\).

If there are \(\theta_{j,k_1}^{p,q},\theta_{j,k_2}^{p,q},...,\theta_{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:\theta_{j,k_1}^{p,q} = \theta_{j,k_2}^{p,q} = \cdots = \theta_{j,k_J}^{p,q}=0\) \(H_1\) : some \(\theta_{j,k_j}^{p,q} \neq 0\)

Let \(\theta_{j,k_{min}}^{p,q}\) and \(\theta_{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_\theta (\theta_{j,k_{min}}^{p,q}), P_\theta(\theta_{j,k_{max}}^{p,q}))\).

Usage

table.pvalues(x)

Arguments

x

the object from BANOVA.*

Examples

Run this code
# NOT RUN {
data(goalstudy)
# }
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab