Title: | Fitting a Log-Binomial Model using the Bekhit-Schöpe-Wagenpfeil (BSW) Algorithm |
---|---|
Description: | Implements a modified Newton-type algorithm (BSW algorithm) for solving the maximum likelihood estimation problem in fitting a log-binomial model under linear inequality constraints. |
Authors: | Adam Bekhit, Jakob Schöpe, Stefan Wagenpfeil |
Maintainer: | Adam Bekhit <[email protected]> |
License: | GPL (>=3) |
Version: | 0.1.1 |
Built: | 2024-11-12 04:10:32 UTC |
Source: | https://github.com/adam-bec/bsw |
bsw()
fits a log-binomial model using a modified Newton-type algorithm (BSW algorithm) for solving the maximum likelihood estimation problem under linear inequality constraints.
bsw(formula, data, maxit = 200L)
bsw(formula, data, maxit = 200L)
formula |
An object of class |
data |
A data frame containing the variables in the model. |
maxit |
A positive integer giving the maximum number of iterations. |
An object of S4 class "bsw"
containing the following slots:
call |
An object of class |
formula |
An object of class |
coefficients |
A numeric vector containing the estimated model parameters. |
iter |
A positive integer indicating the number of iterations. |
converged |
A logical constant that indicates whether the model has converged. |
y |
A numerical vector containing the dependent variable of the model. |
x |
The model matrix. |
data |
A data frame containing the variables in the model. |
Adam Bekhit, Jakob Schöpe
Wagenpfeil S (1996) Dynamische Modelle zur Ereignisanalyse. Herbert Utz Verlag Wissenschaft, Munich, Germany
Wagenpfeil S (1991) Implementierung eines SQP-Verfahrens mit dem Algorithmus von Ritter und Best. Diplomarbeit, TUM, Munich, Germany
set.seed(123) x <- rnorm(100, 50, 10) y <- rbinom(100, 1, exp(-4 + x * 0.04)) fit <- bsw(formula = y ~ x, data = data.frame(y = y, x = x)) summary(fit)
set.seed(123) x <- rnorm(100, 50, 10) y <- rbinom(100, 1, exp(-4 + x * 0.04)) fit <- bsw(formula = y ~ x, data = data.frame(y = y, x = x)) summary(fit)
"bsw"
S4 Class "bsw"
call
An object of class "call"
.
formula
An object of class "formula"
.
coefficients
A numeric vector containing the estimated model parameters.
iter
A positive integer indicating the number of iterations.
converged
A logical constant that indicates whether the model has converged.
y
A numeric vector containing the dependent variable of the model.
x
The model matrix.
data
A data frame containing the variables in the model.
Adam Bekhit, Jakob Schöpe
bsw()
For objects of class "bsw"
, coef()
extracts the estimated model parameters of bsw()
.
## S4 method for signature 'bsw' coef(object)
## S4 method for signature 'bsw' coef(object)
object |
An object of class |
A numeric vector containing the estimated model parameters.
Adam Bekhit, Jakob Schöpe
bsw()
For objects of class "bsw"
, confint()
estimates confidence intervals of the estimated model parameters of bsw()
.
## S4 method for signature 'bsw' confint(object, parm, level = 0.95, method = "wald", R = 1000L)
## S4 method for signature 'bsw' confint(object, parm, level = 0.95, method = "wald", R = 1000L)
object |
An object of class |
parm |
A specification of which model parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all model parameters are considered. |
level |
A numeric value that indicates the level of confidence. |
method |
A character giving the estimation method of the confidence intervals ( |
R |
A positive integer giving the number of bootstrap replicates. |
confint
provides Wald (default) and bias-corrected accelerated bootstrap confidence intervals of the estimated model parameters of bsw()
.
A matrix with columns giving the lower and upper confidence limits of each estimated model parameter.
Adam Bekhit, Jakob Schöpe
bsw()
constr()
sets the linear inequality constraints for bsw()
.
constr(x)
constr(x)
x |
A model matrix. |
A matrix containing the linear inequality constraints for bsw()
.
Adam Bekhit, Jakob Schöpe
bsw()
gradF()
derives the first derivatives of the log likelihood function of the log-binomial model.
gradF(theta, y, x)
gradF(theta, y, x)
theta |
A numeric vector containing the initial values of the model parameters. |
y |
A numeric vector containing the dependent variable of the model. |
x |
The model matrix. |
A numeric vector containing the first derivatives of the log likelihood function of the log-binomial model.
Adam Bekhit, Jakob Schöpe
bsw()
(Hessian matrix)hess()
derives the second partial derivatives of the log likelihood function of the log-binomial model.
hess(theta, y, x)
hess(theta, y, x)
theta |
A numeric vector containing the initial values of the model parameters. |
y |
A numeric vector containing the dependent variable of the model. |
x |
The model matrix. |
A numeric matrix containing the second partial derivatives of the log likelihood function of the log-binomial model (Hessian matrix).
Adam Bekhit, Jakob Schöpe
bsw()
For objects of class "bsw"
, summary()
summarizes the estimated model parameters of bsw()
.
## S4 method for signature 'bsw' summary(object)
## S4 method for signature 'bsw' summary(object)
object |
An object of class |
A list containing the following elements:
coefficients |
A numeric vector containing the estimated model parameters. |
std.err |
A numeric vector containing the estimated standard errors of the model parameters. |
z.value |
A numeric vector containing the estimated z test statistic of the model parameters. |
p.value |
A numeric vector containing the estimated p values of the model parameters. |
Adam Bekhit, Jakob Schöpe