samplingEx {SimRDS}R Documentation

Extracts samples from external populations

Description

Extract samples from populations that the user inputs from an external source without using the inbuilt function 'population' to simulate a population. Data should be in .csv format. Inputs are recruited in the format of the output given in the inbuilt function 'population.'

Usage

samplingEx(
  population,
  response_column,
  degree_column,
  categorical_column,
  id_column,
  degree = NULL,
  net = NULL,
  seeds = 10,
  coupon = 2,
  waves = NULL,
  size = 300,
  prob = NULL,
  prop_sam = NULL,
  showids = TRUE,
  timeInterval = NULL
)

Arguments

population

.csv file containing the population details. The first column should contain the individual's ID.

response_column

Column including responses.

degree_column

Column including degrees.

categorical_column

Column including categories.

id_column

Column including IDs.

degree

.csv file containing the network sizes. If it's not provided, the degree size would be the number of individuals in the networks provided. If both the networks and the degrees are not provided, then it will randomly produce degrees for each respondent.

net

.csv file contains the individual's network. It should contain the same format as the output of the 'net size table' given from the output of the inbuilt function 'population'. If not provided, would randomly assign individuals considering the degree.

seeds

Number of seeds. It should be a positive integer.

coupon

Number of coupons. It should be a positive integer.

waves

Number of waves. It should be a positive integer.

size

Sample size. It should be a positive integer.

prob

Whether the seeds are selected probabilistically. If you want to be selected randomly then leave it as 'NULL' If you want to relate it to a variable, add the variable name, and it should be related. For example, if the seeds selected should depend on the network size, then the 'network' should be used. If it is inversely proportional, then it should enter as '1/network'.

prop_sam

If the individuals from the network of an individual should be chosen randomly use "NULL". If the selection should be done probabilistically, state the variable and how it should be related.

showids

If TRUE, it displays the IDs being recruited.

timeInterval

Days between recruitment waves. Zeroth wave is assumed to recruit at the present day.

Value

RDS sample

Examples


RDS.population <- population(N = 1000,p.ties = 0.6,minVal = 10,zeros = 0,
pr = .5,pa = .1, atype_char = "net",atype_res = "net*char")

# This should be replaced with a real world dataset.
RDS.samplingEx <- samplingEx(population=RDS.population$frame,
response_column="response", degree_column="network",
categorical_column="character", id_column="s", seeds = 40, coupon = 2,
waves =8)


# This function may take considerable time to produce output, depending on
# the computer's performance. For a quick reference to the expected result,
# a saved version of the output is available.
data(RDS.samplingEx)


[Package SimRDS version 2.0.0 Index]