draw_sample_rep: Multiple Sample Selection

View source: R/draw_sample_rep.R

draw_sample_repR Documentation

Multiple Sample Selection

Description

Multiple Sample Selection

Usage

draw_sample_rep(
  dist,
  n,
  rep = 1,
  skew,
  kurts,
  replacement = TRUE,
  col_id = 1,
  col_total = numeric(),
  exact = FALSE
)

Arguments

dist

data frame:consists of id and scores with no missing

n

numeric: desired sample size

rep

numeric: replication

skew

numeric: the skewness value

kurts

numeric: the kurtosis value

replacement

logical:Sample with or without replacement? (default is FALSE).

col_id

index of column ID's

col_total

index of column total score

exact

default is FALSE conduct draw_sample_n_ir function, it is faster and nearest version of draw_sample_ir function.

Value

This function returns a list including following:

  • a matrix: Descriptive statistics of the given data, the reference vector and the sample.

  • a data frame: The id's and scores of the sample

  • graph: Histograms for the “data” and the “sample”

Examples

# Example data provided with package
data(likert_example)
# First 6 rows of the example_data
head(likert_example)
# Draw three samples based on Score_1(from negatively skewed to normal)
# This example takes considerable computation time.
samples <- draw_sample_rep(dist=likert_example,n=200,rep=3,skew=0,
kurts=0,replacement =TRUE,  col_id = 1,
col_total = numeric(),
exact = FALSE)
# to get first sample
samples$sample[[1]]
# to get second sample
samples$sample[[2]]
## Not run: 
# to export 10 samples
for(i in 1:3){
 write.csv(samples$sample[[i]],row.names = FALSE,paste("sample_",i,".csv",sep=""))
 }

## End(Not run)

drawsample documentation built on Sept. 6, 2022, 1:06 a.m.