runstest_w: The Runs Test

Description Usage Arguments Value Examples

View source: R/runstest_w.R

Description

Wrapper around snpar::runs.test. When using this function with a dataframe and the x_order parameter set to NULL, the output includes a warning that x_test must be sorted in the order in which samples were drawn. Use ?snpar::runs.test for technical documentation.

Usage

1
runstest_w(data = NULL, x_test, x_order = NULL)

Arguments

data

A data frame. Set to NULL if testing a vector x_test.

x_test

A data frame column or a vector if data is set to NULL.

x_order

A variable listing the order in which samples were drawn.

Value

snpar::runs.test output (with a warning if using dataframe with x_order = NULL)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#Generate sampling frame  with an index id from 1 to N
math_test <- data.frame("sample_frame_sequence_id" = 1:1000,
                       "math" = rnorm(1000, mean = 75, sd = 15))

#Get output and input in lists
math_test_cobj <- rs_singlestage(df = math_test,
                                 seed_number = 100,
                                 audit_review = "Math Sample",
                                 quantity_to_generate = 20,
                                 quantity_of_spares = 5,
                                 frame_low = 1,
                                 frame_high = 1000)

#Pull the "samples" data frame
math_test_samples <- math_test_cobj$output$sample

#Use runs test to check if data were generated from a random process
runstest_w(data = math_test_samples, x_test = math, x_order = random_numbers)

#Test a vector (must use data = NULL which is the default)
runstest_w(x_test = rnorm(100, 50, 10))

mncube/claimr documentation built on Dec. 21, 2021, 8:07 p.m.