hanaml.ChisqIndependence {hana.ml.r}R Documentation

ChisqIndependence

Description

Perform the chi-squared test of independence to tell whether two variables are independent from each other.

Usage

hanaml.ChisqIndependence(conn.context, data, key = NULL,
                                    observed.data = NULL, correction = NULL)

Arguments

conn.context

codeConnectionContext
Connection to SAP HANA System

data

DataFrame
Dataset used for training the model.

key

character, optional
Name of the ID column in data that specifies the dependent variable.

observed.data

character, optional
Names of the observed data columns. If not given, it defaults to all non-ID columns.

correction

logical, optional
If TRUE, and the degrees of freedom is 1, apply Yates's correction for continuity. The effect of the correction is to adjust each observed value by 0.5 towards the corresponding expected value.
Defaults to FALSE.

Value

Examples

## Not run: 
   Input DataFrame for Preprocessing:
> data$collect()
        ID  X1    X2  X3    X4
 0    male  25  23.0  11  14.0
 1  female  41  20.0  18   6.0

   Create chisquare instance:
 > chisquareindependence <- hanaml.ChisqIndependence(conn, data)
   Expected output:
 > chisquareindependence[[1]]$Collect()
       ID  EXPECTED_X1  EXPECTED_X2  EXPECTED_X3  EXPECTED_X4
0    male    30.493671    19.867089    13.398734     9.240506
1  female    35.506329    23.132911    15.601266    10.759494

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]