Last data update: 2014.03.03

R: Triangular Test for Bernoulli Data
triangular.test.propR Documentation

Triangular Test for Bernoulli Data

Description

Performs a sequential test, compares probabilities in two groups.

Usage

triangular.test.prop(x, y = NULL, p0 = NULL, p1 = NULL, p2 = NULL, alpha
= 0.05, beta = 0.1, delta = NULL, plot = TRUE)

Arguments

x

initial data for group x, at least 1 entry, values restricted to 0 and 1.

y

initial data for group y, at least 1 entry for a two sample test, otherwise omitted, values restricted to 0 and 1.

p0

specifies Null and alternative hypothesis, see Details below.

p1

specifies Null and alternative hypothesis, see Details below.

p2

specifies Null and alternative hypothesis, see Details below.

alpha

Risk of 1st kind

beta

Risk of 2nd kind

plot

logical, indicates whether a initial plot should be generated.

delta

The minimum difference to be detected, alternative way to specify p2=p1+delta, see above, use either this or p2.

Details

One-sample:

This function performs a one- or two-sided sequential Test for p=code{p1} versus

p>code{p2}, if p2 > p1 (one-sided)

p<code{p2}, if p2 < p1 (one-sided)

p<code{p0} or p>code{p2}, if p2 > p1 and p0 < p1 (two-sided, possibly unsymmetric)

Two-sample:

This function performs a one- or two-sided sequential Test for equal proportions p_1=code{p1} p_2=code{p1} versus

p_2>code{p2}, if p2 > p1 (one-sided)

p_2<code{p2}, if p2 < p1 (one-sided)

p_2<code{p0} or p_2>code{p2}, if p2 > p1 and p0 < p1 (two-sided, possibly unsymmetric)

Value

An object of class triangular.test, to be used for later update steps.

Note

A two-sided test may be specified by supplying both p1 and p2, even unsymmetric if needed.

Author(s)

Dieter Rasch, Juergen Pilz, L.R. Verdooren, Albrecht Gebhardt

References

Dieter Rasch, Juergen Pilz, L.R. Verdooren, Albrecht Gebhardt: Optimal Experimental Design with R, Chapman and Hall/CRC, 2011

See Also

triangular.test, triangular.test.norm, update.triangular.test

Examples

data(heights)
attach(heights)
male180 <- as.integer(male>180) 
female164 <- as.integer(female>164)
sum(male180)/length(male180) 
tt <- triangular.test.prop(x=female164[1:3],
   y=male180[1:3], p1=0.4,p2=0.8,p0=0.1,
   alpha=0.05, beta=0.2)
tt <- update(tt,x=female164[4])
tt <- update(tt,y=male180[4])
tt <- update(tt,x=female164[5])
sum(female164)/length(female164)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(OPDOE)
Loading required package: gmp

Attaching package: 'gmp'

The following objects are masked from 'package:base':

    %*%, apply, crossprod, matrix, tcrossprod

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/OPDOE/triangular.test.prop.Rd_%03d_medium.png", width=480, height=480)
> ### Name: triangular.test.prop
> ### Title: Triangular Test for Bernoulli Data
> ### Aliases: triangular.test.prop
> ### Keywords: test
> 
> ### ** Examples
> 
> data(heights)
> attach(heights)
> male180 <- as.integer(male>180) 
> female164 <- as.integer(female>164)
> sum(male180)/length(male180) 
[1] 0.4285714
> tt <- triangular.test.prop(x=female164[1:3],
+    y=male180[1:3], p1=0.4,p2=0.8,p0=0.1,
+    alpha=0.05, beta=0.2)
Triangular Test for bernoulli distribution

H0: p1=p2= 0.4  versus H1: p1= 0.4  and p2>= 0.8  or p2<= 0.1 
alpha: 0.05  beta: 0.2 

Test not finished, continue by adding single data via update()
current sample size for x:  3 
current sample size for y:  3 
> tt <- update(tt,x=female164[4])
Triangular Test for bernoulli distribution

H0: p1=p2= 0.4  versus H1: p1= 0.4  and p2>= 0.8  or p2<= 0.1 
alpha: 0.05  beta: 0.2 

Test not finished, continue by adding single data via update()
current sample size for x:  4 
current sample size for y:  3 
> tt <- update(tt,y=male180[4])
Triangular Test for bernoulli distribution

H0: p1=p2= 0.4  versus H1: p1= 0.4  and p2>= 0.8  or p2<= 0.1 
alpha: 0.05  beta: 0.2 

Test not finished, continue by adding single data via update()
current sample size for x:  4 
current sample size for y:  4 
> tt <- update(tt,x=female164[5])
Triangular Test for bernoulli distribution

H0: p1=p2= 0.4  versus H1: p1= 0.4  and p2>= 0.8  or p2<= 0.1 
alpha: 0.05  beta: 0.2 

Test finished: accept H1 
Sample size for x:  5 
Sample size for y:  4 
> sum(female164)/length(female164)
[1] 0.8571429
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>