drGLM: GLM Transformation Method

Description Usage Arguments Details Value Author(s) See Also Examples

Description

GLM transformation method – Fit a generalized linear model to each subset

Usage

1

Arguments

...

arguments you would pass to the glm function

Details

This provides a transformation function to be called for each subset in a recombination MapReduce job that applies R's glm method and outputs the coefficients in a way that combMeanCoef knows how to deal with. It can be applied to a ddf with addTransform prior to calling recombine.

Value

An object of class drCoef that contains the glm coefficients and other data needed by combMeanCoef

Author(s)

Ryan Hafen

See Also

divide, recombine, rrDiv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Artificially dichotomize the Sepal.Lengths of the iris data to
# demonstrate a GLM model
irisD <- iris
irisD$Sepal <- as.numeric(irisD$Sepal.Length > median(irisD$Sepal.Length))

# Divide the data
bySpecies <- divide(irisD, by = "Species")

# A function to fit a logistic regression model to each species
logisticReg <- function(x)
  drGLM(Sepal ~ Sepal.Width + Petal.Length + Petal.Width,
        data = x, family = binomial())

# Apply the transform and combine using 'combMeanCoef'
bySpecies %>%
  addTransform(logisticReg) %>%
  recombine(combMeanCoef)

datadr documentation built on May 1, 2019, 8:06 p.m.