Teradata Package for R Function Reference | 17.20 - ANOVA - Teradata Package for R - Look here for syntax, methods and examples for the functions included in the Teradata Package for R.

Teradata® Package for R Function Reference

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for R
Release Number
17.20
Published
March 2024
ft:locale
en-US
ft:lastEdition
2024-05-03
dita:id
TeradataR_FxRef_Enterprise_1720
lifecycle
latest
Product Category
Teradata Vantage

ANOVA

Description

The td_anova_sqle() function performs one-way td_anova_sqle (Analysis of Variance) on a data set with two or more groups. td_anova_sqle is a statistical test that analyzes the difference between the means of more than two groups.

The null hypothesis (H0) of td_anova_sqle is that there is no difference among group means. However, if any one of the group means is significantly different from the overall mean, then the null hypothesis is rejected.
You can use one-way Anova when you have data on an independent variable with at least three levels and a dependent variable.

For example, assume that your independent variable is insect spray type, and you have data on spray type A, B, C, D, E, and F. You can use one-way td_anova_sqle to determine whether there is any difference in the dependent variable, insect count based on the spray type used.

Usage

  td_anova_sqle (
      data = NULL,
      group.columns = NULL,
      alpha = 0.05,
      ...
  )

Arguments

data

Required Argument.
Specifies the input tbl_teradata.
Types: tbl_teradata

group.columns

Optional Argument.
Specifies the names of the columns in "data" to use in the computation.
Note:
Users must specify at least two columns in "group.columns" list.
Types: vector of character

alpha

Optional Argument.
Specifies the probability of rejecting the null hypothesis when the null
hypothesis is true.
Default Value: 0.05
Types: float

...

Specifies the generic keyword arguments SQLE functions accept. Below
are the generic keyword arguments:

persist:
Optional Argument.
Specifies whether to persist the results of the function in a table or not. When set to TRUE, results are persisted in a table; otherwise, results are garbage collected at the end of the session.
Default Value: FALSE
Types: logical

volatile:
Optional Argument.
Specifies whether to put the results of the function in a volatile table or not. When set to TRUE, results are stored in a volatile table, otherwise not.
Default Value: FALSE
Types: logical

Function allows the user to partition, hash, order or local order the input data. These generic arguments are available for each argument that accepts tbl_teradata as input and can be accessed as:

  • "<input.data.arg.name>.partition.column" accepts character or vector of character (Strings)

  • "<input.data.arg.name>.hash.column" accepts character or vector of character (Strings)

  • "<input.data.arg.name>.order.column" accepts character or vector of character (Strings)

  • "local.order.<input.data.arg.name>" accepts logical

Note:
These generic arguments are supported by tdplyr if the underlying SQL Engine function supports, else an exception is raised.

Value

Function returns an object of class "td_anova_sqle" which is a named list containing object of class "tbl_teradata".
Named list member(s) can be referenced directly with the "$" operator using the name(s):result

Examples

  
    
    # Get the current context/connection.
    con <- td_get_context()$connection
    
    # Load the example data.
    loadExampleData("tdplyr_example", "insect_sprays")
    
    # Create tbl_teradata object.
    insect_sprays <- tbl(con, "insect_sprays")
    
    # Check the list of available analytic functions.
    display_analytic_functions()
    
    # Example 1 : Perform one-way anova analysis on a data set with
    #             two or more groups.
    ANOVA_out_1 <- td_anova_sqle(data = insect_sprays,
                                 alpha = 0.05)
    
    # Print the result.
    print(ANOVA_out_1$result)
    
    # Example 2 : Perform one-way anova analysis on a data set with more
    #             than two groups and group.columns argument specified.
    ANOVA_out_2 <- td_anova_sqle(data = insect_sprays,
                                 group.columns=colnames(insect_sprays)[3:5],
                                 alpha = 0.05)
    
    # Print the result.
    print(ANOVA_out_2$result)