TargetedLearning.LReg
Exported
TargetedLearning.LReg ¶
This module wraps some functionality from GLMNet.jl for logistic regression.
source: TargetedLearning/src/LReg.jl:6
linpred(lr::TargetedLearning.LReg.LR{T<:AbstractFloat}, newx) ¶
Returns the linear component of predicted values from a logistic regression fit with a new X matrix
Arguments
lr- an object of typeLRnewx- matrix of new covariates to predict on. Should be the same dimension as the design matrix used to fitlr
Keyword Arguments
offset- offsets. The length should be the same assize(newx, 1)oflrwas fit with an offset, or 0 otherwise.
source: TargetedLearning/src/LReg.jl:41
lreg(x, y) ¶
Fits a logistic regression model
Arguments
x- design matrixy- response vector. Should have the same length assize(x, 1)
Keyword Arguments
wts- weight vector. Defaults to all 1s.offset- offset vector. Defaults to a vector of length 0 for no offset.subset- column indexes forxthat should be included in the fit. Defaults to all columns.convTol- convergence criterion for relative change in deviance. Defaults to 1.0e-8.
Details
An intercept is not included by default. If you want one, make sure the first column of your design matrix
is all ones. Because of how GLMNet handles intercepts and how LReg interfaces with it,
this must be the first column.
If you do that, don't forget to add the column in the same place to newx when you call predict.
subset is useful if you want to include only some columns of the design matrix but you want to call predict
with a newx matrix with the same number of columns as x. The coefficients corresponding to columns of x which
are not used in the fit are set to zero. If you would like to call predict with a newx matrix that includes
only the columns that you fit on, you should subset x yourself before calling lreg.
source: TargetedLearning/src/LReg.jl:110
predict(lr::TargetedLearning.LReg.LR{T<:AbstractFloat}, newx) ¶
Returns the predicted on the probability scale values from a logistic regression fit with a new X matrix
Arguments
lr- an object of typeLRnewx- matrix of new covariates to predict on. Should be the same dimension as the design matrix used to fitlr
** Keyword Arguments
offset- offsets. The length should be the same assize(newx, 1)oflrwas fit with an offset, or 0 otherwise.
source: TargetedLearning/src/LReg.jl:69
TargetedLearning.LReg.LR{T<:AbstractFloat} ¶
The LR type contains the coefficent vector of a logistic regression fit, as well as indexes of
included columns in the design matrix.
source: TargetedLearning/src/LReg.jl:20