SL.sgd.poisson: Computes a stochastic gradient step for poisson regression

Description Usage Arguments Value Examples

Description

Wrapper function for using Poisson GLM with online SL. If the function is called with initial=TRUE then fits a Poisson regression using the specified formula and returns predicted values on data frame newX. Any input for fit is ignored. This is called by onlinesl to obtain starting values for the SGD algorithm. If the function is called with inital=FALSE, the function computes a prediction on newX based on the current fit and updates the value of fit by taking a step in the direction of the gradient. The function returns a list with named entries fit and pred. fit contains the current regression parameter estimate, while pred contains the predictions on the newX data frame.

Usage

1
2
SL.sgd.poisson(Y, X, newX, t, fit, initial = FALSE, formula = "Y ~ .",
  stepSize = function(t) {     1/t }, ...)

Arguments

Y

The numeric input outcome

X

The data.frame of predictors (ignored if initial = FALSE)

newX

The data.frame to return predictions for.

t

The numeric step number (ignored if initial = TRUE)

fit

A list of the current fit with named entry theta corresponding to the regression parameter estimates at the previous iteration and formula corresponding to the regression formula used by the function.

initial

Boolean as to whether the function should be called to obtain initial regression parameter estimates or whether it should perform an SGD updating step

formula

The regression formula to be used, specified as a character

stepSize

A function evaluating what step size to use in the SGD algorithm (ignored if initial = TRUE)

initial

A boolean indicating whether to execute the function for initial parameter estimates or for an sgd update step.

Value

fit An object of class SL.sgd.poisson. A named list with entries theta and formula consisting of the current regression parameter estimates and the regression formula.

pred Predictions on newX either based on an initial call to glm (if initial = TRUE) or based on an SGD update (if initial=FALSE)

Examples

1
Examples to come

benkeser/onlinesl documentation built on May 12, 2019, 12:09 p.m.