sim.bin | R Documentation |
This function generates a random sample from an discrete choice regression model.
sim.bin( coef = 2L, nObs = 100, probit = FALSE, maxWeight = 1, pPos = 0.5, sampleFactor = 4, toNumeric = TRUE )
coef |
Either a single integer specifying the number of variables in the model, or a numeric vector of coefficients for the regression. |
nObs |
The number of observations to generate. |
probit |
Logical value indicating whether to generate data from a probit model
(if |
maxWeight |
Integer value indicating the maximum weight of the observations.
If |
pPos |
The percentage of positive observations ( |
sampleFactor |
The factor used to control the size of the initial sample. A larger value generates a larger initial sample, which can increase the accuracy of the generated sample but also takes more time and memory. |
toNumeric |
If |
A list with the following items:
y |
The endogenous variable. |
x |
The exogenous variables. |
w |
The weights of the observations. It is |
p1 |
Prob(Y=1) |
coef |
The coefficients of the regression. |
probit |
Logical value indicating whether data was generated from a probit model. |
pPos |
The percentage of negative observations in y. |
estim.bin, search.bin
# Generate data from a logit model with 3 variables sample <- sim.bin(3L, 100) # see the examples in 'estim.bin' or 'search.bin' functions