Exact dichotomous-response inference

Cochran's Test

Compute exact p-values, Type I error, Type II error, and power for Cochran's test using FMCI.

What it computes

Exact tail probabilities at the observed critical value

Supported models

Observed K-by-b binary matrix; optional alternative-hypothesis probability matrix

Main inputs

Observed matrix X₀ and, when needed, alternative matrix P

Single-window web-app note

The original desktop instructions sometimes refer to buttons that open separate input windows. In this single-window web version, enter those same values directly in the text boxes or tables on the current tab. The mathematical meaning of the inputs and outputs is unchanged.

Purpose

This app computes exact probabilities for Cochran's test for dichotomous 0/1 responses using finite Markov chain imbedding (FMCI).

The app can compute:
    1. exact p-value for an observed 0/1 matrix X0
    2. exact Type I error at the observed critical value
    3. exact Type II error and power under a specified H_a
Data layout

The observed matrix X0 is K-by-b:

    rows    = treatments
    columns = blocks
    entries = 0 or 1 dichotomous responses

Example with K = 4 treatments and b = 8 blocks:

    X0 = [0 0 0 1 0 0 0 1;
          1 0 1 1 1 1 0 1;
          0 1 1 0 0 1 1 0;
          0 0 1 0 1 1 0 1]
Inputs
No. of Treatments
    Enter K, the number of treatment rows in X0.
Enter The Matrix
    Opens a table for entering the observed matrix X0.
    Enter the number of blocks b, click Resize Table if
    needed, then enter the K-by-b 0/1 matrix.
Enter H_a prob.
    Opens a table for entering the alternative-hypothesis
    success probability matrix P.
    P must have the same size as X0, K-by-b.
    Every entry must be strictly between 0 and 1.
    P(i,j) is the success probability for treatment i in
    block j under the alternative hypothesis H_a.
What the app computes

After X0 is entered, the app computes:

    column totals: x_j = sum_i X0(i,j)
    row totals:    X_i. = sum_j X0(i,j)
    critical value v = sum_i X_i.^2
Exact p-value:
    p-value = P(V >= v | H0)
Type I error:
    alpha = P(V >= v | H0)
Type II error and power, if H_a probability matrix P is given:
    power = P(V >= v | H_a)
    beta  = 1 - power
Step-by-step use
Step 1. Click Clear all items.
Step 2. Enter No. of Treatments.
    Example: K = 4
Step 3. Click Enter The Matrix.
    Set number of blocks b.
    Example: b = 8
    Enter the observed 0/1 matrix X0.
    Click Save.
Step 4. Optional: click Enter H_a prob.
    Enter the K-by-b probability matrix under H_a.
    Click Save.
    This is needed only for Type II error and power.
Step 5. Click Calculate the Probability.
    The Results panel displays the p-value, Type I error,
    and, if P is entered, Type II error and power.
Example 1: exact p-value only

K = 4, b = 8

Observed matrix:

    0 0 0 1 0 0 0 1
    1 0 1 1 1 1 0 1
    0 1 1 0 0 1 1 0
    0 0 1 0 1 1 0 1
Steps:
    Enter No. of Treatments = 4
    Click Enter The Matrix
    Set b = 8 and enter the matrix above
    Click Save
    Click Calculate the Probability
Expected p-value for this example is approximately:
    0.3344727
Example 2: Type II error and power

Use the same observed matrix as Example 1.

Alternative H_a probability matrix example:

    P = [0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2;
         0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2;
         0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2;
         0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3]
Steps:
    Enter the observed matrix X0
    Click Enter H_a prob.
    Enter the probability matrix P above
    Click Save
    Click Calculate the Probability
The app displays:
    p-value under H0
    Type I error alpha under H0
    Type II error beta under H_a
    Power = 1 - beta
Common mistakes
  1. X0 must contain only 0 and 1.
  1. The number of rows of X0 must equal K.
  1. The H_a probability matrix P must have the same size as X0.

4. Entries of P must be strictly between 0 and 1. Do not use 0 or 1 in P.

  1. If you change K, re-enter X0 and P.
Clearing the app
Click Clear all items to clear:
    K input
    saved observed matrix X0
    saved H_a probability matrix P
    results output