Last data update: 2014.03.03

R: Triangular Test for Normal Data
triangular.test.normR Documentation

Triangular Test for Normal Data

Description

Performs a sequential test, compares means of two normally distributed groups.

Usage

triangular.test.norm(x, y = NULL, mu0 = NULL, mu1, mu2 = NULL,
                     delta = NULL, sigma = NULL, sigma2 = NULL,
                     alpha = 0.05, beta = 0.1, plot = TRUE)

Arguments

x

initial data for group x, at least 1 entry.

y

initial data for group y, at least 1 entry for a two sample test, otherwise omitted.

mu0

specifies Null and alternative hypothesis, see Details below.

mu1

specifies Null and alternative hypothesis, see Details below.

mu2

specifies Null and alternative hypothesis, see Details below.

delta

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

sigma

prior sigma.

sigma2

prior sigma for group 2 if different than for grouop 1.

alpha

Risk of 1st kind

beta

Risk of 2nd kind

plot

logical, indicates whether a initial plot should be generated.

Details

One-sample:

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

μ>code{mu2}, if mu2 > mu1 (one-sided)

μ<code{mu2}, if mu2 < mu1 (one-sided)

μ<code{mu0} or μ>code{mu2}, if mu2 > mu1 and mu0 < mu1 (two-sided, possibly unsymmetric)

Two-sample:

This function performs a one- or two-sided sequential Test for equal means μ_1=code{mu1} μ_2=code{mu1} in both groups versus

μ_2>code{mu2}, if mu2 > mu1 (one-sided)

μ_2<code{mu2}, if mu2 < mu1 (one-sided)

μ_2<code{mu0} or μ_2>code{mu2}, if mu2 > mu1 and mu0 < mu1 (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 mu1 and mu2, 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.prop, update.triangular.test

Examples

data(heights)
attach(heights)
# a symmetric two sided alternative:
tt <- triangular.test.norm(x=female[1:3],
   y=male[1:3], mu1=170,mu2=176,mu0=164,
   alpha=0.05, beta=0.2,sigma=7)
# Test is yet unfinished, add the remaining values step by step:
tt <- update(tt,x=female[4])
tt <- update(tt,y=male[4])
tt <- update(tt,x=female[5])
tt <- update(tt,y=male[5])
tt <- update(tt,x=female[6])
tt <- update(tt,y=male[6])
tt <- update(tt,x=female[7])
tt <- update(tt,y=male[7])
# Test is finished now
# an unsymmetric two sided alternative:
tt2 <- triangular.test.norm(x=female[1:3],
   y=male[1:3], mu1=170,mu2=180,mu0=162,
   alpha=0.05, beta=0.2,sigma=7)
tt2 <- update(tt2,x=female[4])

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.norm.Rd_%03d_medium.png", width=480, height=480)
> ### Name: triangular.test.norm
> ### Title: Triangular Test for Normal Data
> ### Aliases: triangular.test.norm
> ### Keywords: test
> 
> ### ** Examples
> 
> data(heights)
> attach(heights)
> # a symmetric two sided alternative:
> tt <- triangular.test.norm(x=female[1:3],
+    y=male[1:3], mu1=170,mu2=176,mu0=164,
+    alpha=0.05, beta=0.2,sigma=7)
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
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 
> # Test is yet unfinished, add the remaining values step by step:
> tt <- update(tt,x=female[4])
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
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=male[4])
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
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=female[5])
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
alpha: 0.05  beta: 0.2 

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

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
alpha: 0.05  beta: 0.2 

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

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
alpha: 0.05  beta: 0.2 

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

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
alpha: 0.05  beta: 0.2 

Test not finished, continue by adding single data via update()
current sample size for x:  6 
current sample size for y:  6 
> tt <- update(tt,x=female[7])
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
alpha: 0.05  beta: 0.2 

Test not finished, continue by adding single data via update()
current sample size for x:  7 
current sample size for y:  6 
> tt <- update(tt,y=male[7])
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 176  or mu2<= 164 
alpha: 0.05  beta: 0.2 

Test finished: accept H1 
Sample size for x:  7 
Sample size for y:  7 
> # Test is finished now
> # an unsymmetric two sided alternative:
> tt2 <- triangular.test.norm(x=female[1:3],
+    y=male[1:3], mu1=170,mu2=180,mu0=162,
+    alpha=0.05, beta=0.2,sigma=7)
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 180  or mu2<= 162 
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 
> tt2 <- update(tt2,x=female[4])
Triangular Test for normal distribution

Sigma known: 7 

H0: mu1=mu2= 170  versus H1: mu1= 170  and mu2>= 180  or mu2<= 162 
alpha: 0.05  beta: 0.2 

Test finished: accept H1 
Sample size for x:  4 
Sample size for y:  3 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>