generateSamplePanel: generate sample panel

Description Usage Arguments Value Author(s) Examples

Description

generate sample panel

Usage

1
2
  generateSamplePanel(n, q, freq, start, end, seed = 1,
    rng = 1:3, groupList = NA, weight = 1)

Arguments

n

number of observations

q

number of questions

freq

character string indicating frequency, can be "annually", "quarterly", "monthly". Supports fuzzy unabmigous strings.

start

vector containing year,period

end

vector containing year,period'

seed

for reproducible random number generation

rng

of the categorical scale default 1-3

weight

vector of weights, if of greater length than n, a sample of length n is drawn, default is set to 1 (equal weights)

Value

data.frame that represents BTS typical data

Author(s)

Matthias Bannert

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# generate survey likerandom sample
srvyData <- generateSamplePanel(500,3,"quarterly",
                                c(1999,1),
                                c(1999,1),
                                weight=round(runif(500,2,80)))


# generate 
grps <- generateRandomGroups(3,1:500,LETTERS)

# merge group information by uid
srvyWgroups <- merge(grps,srvyData,by="uid")

# add some NAs (to simulate item non-response)
# check which cols should be protected from 
# being hit by random NAs
head(srvyWgroups)
randomPanel <- generateRandomNAs(srvyWgroups,c(1,2,3,4),50,1)
randomPanel

mbannert/gateveys documentation built on May 21, 2019, 2:23 p.m.