Teradata Package for R Function Reference | 17.20 - FTest - 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
Language
English (United States)
Last Update
2024-05-03
dita:id
TeradataR_FxRef_Enterprise_1720
Product Category
Teradata Vantage

FTest

Description

The td_ftest_sqle() function performs an F-test, for which the test statistic follows an F-distribution under the Null hypothesis.
Function compares the variances of two independent populations.
If the variances are significantly different, the td_ftest_sqle() function rejects the Null hypothesis, indicating that the variances may not come from the same underlying population.
Use the function to compare statistical models that have been fitted to a data set, to identify the model that best fits the population from which the data were sampled.

Usage

  td_ftest_sqle (
      data = NULL,
      alpha = NULL,
      first.sample.variance = NULL,
      first.sample.column = NULL,
      df1 = NULL,
      second.sample.variance = NULL,
      second.sample.column = NULL,
      df2 = 2,
      alternate.hypothesis = 'two-tailed',
      ...
  )

Arguments

data

Required Argument.
Specifies the input tbl_teradata.
Types: tbl_teradata

alpha

Optional Argument.
Specifies the probability of rejecting the null hypothesis when it is true (value below which null hypothesis is rejected).
"alpha" must be a numeric value in the range [0, 1].
Default Value: 0.05
Types: float

first.sample.variance

Required if "first.sample.column" is omitted, disallowed otherwise.
Specifies the variance of the first sample population.
Types: float

first.sample.column

Required if "first.sample.variance" is omitted, disallowed otherwise.
Specifies the name of the input column that contains the data for the
first sample population.
Types: character

df1

Required if "first.sample.column" is omitted, disallowed otherwise.
Specifies the degrees of freedom of the first sample.
Types: integer

second.sample.variance

Required if "second.sample.column" is omitted, disallowed otherwise.
Specifies the variance of the second sample population.
Types: float

second.sample.column

Required if "second.sample.variance" is omitted, disallowed otherwise.
Specifies the name of the input column that contains the data for the second sample population.
Types: character

df2

Required if "second.sample.column" is omitted, disallowed otherwise.
Specifies the degrees of freedom of the second sample.
Types: integer

alternate.hypothesis

Optional Argument.
Specifies the alternative hypothesis.
Permitted Values:

  • lower-tailed - Alternate hypothesis (H 1): μ < μ0.

  • upper-tailed - Alternate hypothesis (H 1): μ > μ0.

  • two-tailed - Rejection region is on two sides of sampling distribution of test statistic.
    Two-tailed test considers both lower and upper tails of distribution of test statistic.
    Alternate hypothesis (H 1): μ ≠ μ0

Default Value: two-tailed
Types: character

...

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 Strings (character) (Strings)

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

  • "<input.data.arg.name>.order.column" accepts character OR vector of Strings (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_ftest_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", "titanic")
    
    # Create tbl_teradata object.
    titanic_data <- tbl(con, "titanic")
    
    # Check the list of available analytic functions.
    display_analytic_functions()
    
    # Example 1: Run td_ftest_sqle() with first.sample.variance, second.sample.variance,
    #            df1 and df2.
    obj <- td_ftest_sqle(data=titanic_data,
                         alpha=0.5,
                         second.sample.column="parch",
                         alternate.hypothesis="two-tailed",
                         first.sample.variance=5,
                         second.sample.variance=8,
                         df1=1,
                         df2=2
                         )
    
    # Print the result.
    print(obj$result)
    
    # Example 2: Run td_ftest_sqle() with only required arguments.
    obj <- td_ftest_sqle(data=titanic_data,
                         second.sample.column="parch",
                         second.sample.variance=8,
                         df2=2
                         )
    
    # Print the result.
    print(obj$result)