Generates a data.frame
or data.table
with a binary outcome, and a logistic model to
describe it.
genBinomDf(
b = 2L,
f = 2L,
c = 1L,
n = 20L,
nlf = 3L,
pb = 0.5,
rc = 0.8,
py = 0.5,
asFactor = TRUE,
model = FALSE,
timelim = 5,
speedglm = FALSE
)genBinomDt(
b = 2L,
f = 2L,
c = 1L,
n = 20L,
nlf = 3L,
pb = 0.5,
rc = 0.8,
py = 0.5,
asFactor = TRUE,
model = FALSE,
timelim = 5,
speedglm = FALSE
)
The number of binomial variables (the number of predictors which are binary).
These are limited to \(0\) or \(1\).
The number of factor predictors.
The number of predictors
which are factor
s.
The number of continuous predictors.
the number of predictors which are continuous.
The number of observations (rows) in the
data.frame
or data.table
.
The number of levels in a factor.
The probability for binomnial predictors:
the probability of binomial predictors being \(=1\).
E.g. if pb=0.3
, \(30\%\) will be \(1\)s,
\(70\%\) will be \(0\)s
The ratio for continuous variables.
The ratio of levels of
continuous variables to the total number of
observations n
.
E.g. if rc=0.8
and n=100
,
it will be in the range \(1\) to \(80\).
The ratio for y, the ratio of \(1\)s to the total number of observations for the binomial predictors.
E.g. if ry=0.5
,
50% will be \(1\)s, \(50\%\) will be \(0\)s.
If asFactor=TRUE
(the default),
predictors given as factor
s
will be converted to factor
s
in the data frame before the model
is fit.
If model=TRUE
,
will also return a model fitted with
stats::glm
or speedglm::speedglm
function will timeout after timelim
secs.
This is present to prevent duplication of rows.
If speedglm=TRUE
,
return a model fitted with speedglm
instead of glm
. See:
?speedglm::speedglm
If model=TRUE
: a list with the following values:
A data.frame
(for genBinomDf
)
or data.table
(for genBinomDt
).
Predictors are labelled \(x1, x2, ..., xn\).
The response is \(y\).
Rows represent to \(n\) observations
A model fit with stats::glm
or speedglm::speedglm
# NOT RUN {
set.seed(1)
genBinomDf(speedglm=TRUE)
genBinomDt(b=0, c=2, n=100L, rc=0.7, model=FALSE)
# }
Run the code above in your browser using DataLab