glm {SparkR}R Documentation

Fits a generalized linear model

Description

Fits a generalized linear model, similarly to R's glm(). Also see the glmnet package.

Usage

glm(formula, family = gaussian, data, weights, subset, na.action,
  start = NULL, etastart, mustart, offset, control = list(...),
  model = TRUE, method = "glm.fit", x = FALSE, y = TRUE,
  contrasts = NULL, ...)

## S4 method for signature 'formula,ANY,DataFrame'
glm(formula, family = c("gaussian",
  "binomial"), data, lambda = 0, alpha = 0)

Arguments

formula

A symbolic description of the model to be fitted. Currently only a few formula operators are supported, including '~', '+', '-', and '.'.

family

Error distribution. "gaussian" -> linear regression, "binomial" -> logistic reg.

data

DataFrame for training

lambda

Regularization parameter

alpha

Elastic-net mixing parameter (see glmnet's documentation for details)

Value

a fitted MLlib model

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D data(iris)
##D df <- createDataFrame(sqlContext, iris)
##D model <- glm(Sepal_Length ~ Sepal_Width, df)
## End(Not run)

[Package SparkR version 1.5.1 Index]