Learn R Programming

blm (version 2013.2.4.1)

blm: Fit a binomial linear regression model

Description

A direct probability model for regression with a binary outcome from observational data.

Usage

blm(formula, data, na.action = na.omit, weights = NULL, 
    strata = NULL, par.init = NULL, warn=FALSE,...)

Arguments

formula
formula for linear model for binary outcome, event~x1+x2+...
data
data.frame containing the variables of formula
na.action
function specifying how missing data should be handled, na.action
weights
Vector of weights equal to the number of observations. For population-based case-control study, weights are the inverse sampling fractions for controls.
strata
vector indicating the stratification for weighted regression with stratified observational data
par.init
vector (optional) of initial parameters
warn
logical indicator whether to include warnings during algorithm fitting. Default of FALSE suppresses warnings when testing for feasible parameters.
...
Additional arguments passed to constrOptim

Value

  • Returns an object of class blm.

Details

The blm model coefficients are the solutions to the maximum of a pseudo log-likelihood using a constrained optimization algorithm with an adaptive barrier method, constrOptim (Lange, 2010). Variance estimates are based on Taylor linearization (Shah, 2002). When weights are not NULL, it is assumed that the study is a case-control design.

References

Lange, K. (2010) Numerical Analysis for Statisticians, Springer. Shah, BV. (2002) Calculus of Taylor deviations. Joint Statistical Meetings.

See Also

constrOptim

Examples

Run this code
data(ccdata)

fit <- blm(y~female+packyear, weights = ccdata$w,strata=ccdata$strata,
				data=ccdata)

summary(fit)


data(aarp)

# ABSOLUTE RISK OF BLADDER CANCER BY 70 YEARS
# FOR DIFFERENT GENDER AND RISK GROUP

fit <- blm(bladder70~female * smoke_status, 
			      data = aarp, 
			      weight=aarp$w)

# INTERCEPT IS BASELINE RISK
# ALL OTHER COEFFICIENTS ARE RISK DIFFERENCES FROM BASELINE

summary(fit)

# RISK DIFFERENCE CONFIDENCE INTERVALS (PER 1,000 PERSONS)
confint(fit)*1000

Run the code above in your browser using DataLab