View source: R/LogisticRegression.R
lr | R Documentation |
lr
is used to fit a logistic regression model for a binary response variable.
lr(formula, data, init = NULL)
formula |
an object of class |
data |
a required data frame containing the variables in the model |
init |
optional initial conditions to be passed to optimisation of the log-likelihood |
The form of the formula
argument will be of the form response ~ predictor1 + predictor2 + ...
,
with predictor1
and predictor2
being named columns of the data frame in data
.
The log-likelihood (from loglik_lr
) is maximised using irls.lr
with initial estimates given by init
.
If no initial values are supplied, this uses a vector of zeros instead.
An S3 object of class 'lr', which is a list containing
coefficients |
a vector of coefficients corresponding to covariates specified in |
data |
the |
formula |
the |
X |
the model matrix |
val |
value of the final log-likelihood at the values of |
its |
number of iterations performed to retrieve the maximised log-likelihood |
y = sample(0:1, 50, replace=TRUE)
d = data.frame(y = y, x = rnorm(10*y + 15))
fit = lr(y ~ x, data = d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.