test: Calculates the statistics for hypotesis tests

Description Usage Arguments Value Examples

View source: R/test.R

Description

This function calculates de statistics for hypotesys tests considering the following hypotesis:

H_{0}:\text{ } μ \neq μ_{0}

H_{0}:\text{ } \bar{p} \neq p_{0}

H_{0}:\text{ } μ ≤q \text{ or } ≥q μ_{0}

H_{0}:\text{ } \bar{p} ≤q \text{ or } ≥q p_{0}

Usage

1
2
3
test(sample.data, num.col = NULL, prop.col = NULL, mu0 = NULL,
  p0 = NULL, alpha, alternative = NULL, labels = NULL,
  plot.graph = FALSE)

Arguments

sample.data

The source data.frame from which the funtion will search the columns.

num.col

Vector of the numeric column numbers.

prop.col

Vector of the binary column numbers.

mu0

Hypothesized mean.

p0

Hypothesized proportion.

alpha

Level of significance.

alternative

1 if is a greater/lesser test and 2 for equal/different one.

labels

Label vector for the outputs.

plot.graph

Plot a confidence intervals for proportions only. Not implemented yet.

Value

data.frame containing the following:

var

The label of the variable/parameter.

point

Point estimate.

tolerance

The hypothesized mean/proportion.

sdd_err

Standard error.

z_value

Statistics z.

pval

P-value.

power

Test power, defined as (1 - β).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
n=168
set.seed(101)
dados <- data.frame(CONTROLE1=rbinom(n,1,prob = 0.4),
                    CONTROLE2=rbinom(n,1,prob = 0.02),
                    CONTROLE3=rbinom(n,1,prob = 0.1),
                    CONTROLE4=rbinom(n,1,prob = 0.01),
                    CONTROLE5=rbinom(n,1,prob = 0.2),
                    CONTROLE6=rnorm(n,10,3),
                    CONTROLE7=rnorm(n,250,20))
test(sample.data = dados, num.col = 6:7, prop.col = 1:5, alpha = 0.05,
     mu0 = c(10,100),p0=c(0.05,0.05,0.10,0.10,0.1),
     alternative = c(rep(1,5),rep(2,2)))

cgu-dados/auditsampling documentation built on March 24, 2021, 9:38 a.m.