Learn R Programming

blm (version 2011.1.3)

blm: Fit a binomial linear regression model

Description

Binomial linear model for cohort binary data.

Usage

blm(f,data,par.init,ineq=NULL,trace=FALSE,tol=1e-6,augmented=TRUE,warn=-1,...)

Arguments

f
formula for linear model for binary outcome, event~x1+x2+...
data
data.frame containing the variables of f
par.init
optional vector of user-specified initial parameters
ineq
optional user-specified inequality constraint matrix.
trace
logical, whether details of optimization should be printed with each outer iteration.
tol
numeric criterion for judging a constraint active when augmented is FALSE.
augmented
logical, whether the optimization method should use constrained optimization with an augmented Lagrangian (see details).
warn
numerical, passed to options during run. Default suppresses warning messages.
...
Additional argument to control.outer of auglag and constrOptim.nl

Value

  • Returns an object of class blm.

Details

blm is a wrapper for auglag and constrOptim.nl from the alabama package, which performs constrained optimization for nonlinear functions and linera/nonlinear inequality constraints. constrOptim.nl performs the constrained optimization procedure with a interior point adaptive barrier (Lange, 2010). If augmented is TRUE than an augmented Lagrangian method is used (Madsen, 2004). When par.init is not specified, a linear projection of the OLS estimators into the feasible region are used. The ineq matrix is determined automatically from the unique covariate patterns of the design matrix containing only the extreme values (endpoints of empirical range) for each column of continuous variables. It can also be supplied directly by the user. In this case, it is a matrix with the rows equal to the number of inequality constraints for the lower bound and the columns corresponding to each column of the model design matrix. When a constraint is at the boundary of the feasible region, the constraint will be approximately zero when evaluated at the final estimates of the algorithm. When using the augmented Lagrangian, an active constraint is defined as one where the multiplier lambda is non-zero. When augmented is FALSE (i.e. classical barrier method is used) tol is the criterion for zero, so any evaluated constraints less than or equal to tol are considered active. If any constraints are active, the covariance-variance based on the Taylor series approximation might be inaccurate. Since the augmented Lagrangian procedure takes into the active constraints into account when computing the Hessian matrix, whose inverse is the covariance-variance of the model estimates, this is the recommended method for estimation at the boundary.

References

Lange, K (2010). Numerical Analysis for Statisticians, Springer. Madsen K, Nielsen HB, Tingleff O (2004). Optimization with Constraints, IMM, DTU,

See Also

blm-class, constrOptim.nl,summary

Examples

Run this code
data(grad)

fit <- blm(admit~factor(rank),grad)

fit 

summary(fit)

ci(fit,c(1,0,0,0))  #PROB GRAD SCHOOL ADMISSION 
		    #FOR STUDENTS FROM MOST PRESTIGIOUS SCHOOL


### INCLUDE FACTORS FOR UNDERGRAD GPA AND GRE AND SUPPLY INITIAL VALUES

fit2 <- blm(admit~I(scale(gre))+I(scale(gpa))+factor(rank),grad)

fit2

summary(fit2)

### IMPROVEMENT IN AIC USING 2 DEGREES OF FREEDOM

summary(fit)$AIC-summary(fit2)$AIC 

### IF FIT WITH ADAPTIVE BARRIER METHOD
### STANDARD ERROR MIGHT BE INCORRECT WHEN CONSTRAINTS ARE ACTIVE

fit2 <- blm(admit~I(scale(gre))+I(scale(gpa))+factor(rank),grad,augmented=FALSE)

fit2

Run the code above in your browser using DataLab