inference: Outputs a table with SRS and Stratified based inferences

Description Usage Arguments Value

View source: R/inference.R

Description

This function do Simple Random Sample and Stratified inferences from a sample data, given an alpha level. It can calculate estimates for means, totals, proportions and ratios too. It have option to print a Word *.docx table with the estimate parameters and two plotting graph types.

Usage

1
2
3
4
inference(sample.data, num.y = NULL, denom.x = NULL, total.x = NULL,
  cat.y = NULL, strat = NULL, post.strat = NULL, alpha, N = Inf,
  type = rep("mean", length(num.y) + length(cat.y)), fpc = NULL,
  labels = NULL, print.report = FALSE)

Arguments

sample.data

A data.frame representing a sample with the collected data.

num.y

The index number of the columns (vector) where the data is continuous.

total.x

If you are using ratio estimators and want to estimate totals, you gonna need a total of \bar{X}. Use vectors of the same length as your estimated variables for estimate totals. If you don't provide totals, they will be estimated from data.

cat.y

The index number of the columns where the data is categorical.

strat

The index number of the columns to be used as stratified design.

post.strat

The index number of the columns to used as a post stratified design.

alpha

1 - Confidence level.

N

Population size.

type

A vector of characters. Allowed means, totals or ratios. The function use mean as default.

fpc

The index number of the column to be used as the factor of population correction.

labels

An optional string vector of labels to be putted into printed table.

print.report

FALSE by default. If TRUE, prints a .docx table. Must have the same length of the sum of numerical columns and all levels of categorical columns.

denom.y

The index number of the columns (vector) that will be used as denominator for ratio estimators. Use NULL if you don't want to use ratio estimators or combine regular estimators with ratio ones.

Value

A data.frame containing the following:

parameter

The label of the parameter.

n

The effective sample size.

se

Standard error.

point.estimate

Point estimate.

interval

Confidence interval.


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