glm,formula,ANY,DataFrame-method {SparkR}R Documentation

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

Description

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

Usage

## 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.4.0 Index]