TD_ZTest Function | Z Test | Teradata Vantage - TD_ZTest - Analytics Database

Database Analytic Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-06
dita:mapPath
gjn1627595495337.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
jmh1512506877710
Product Category
Teradata Vantage™

TD_ZTest performs a Z-test. A Z-test is a statistical hypothesis test that you can use to determine whether two population means are different when the population standard deviation or variance is known. The test is based on the Z-statistic, which is the number of standard deviations that the sample mean is from the population mean.

TD_ZTest tests the equality of two means under the assumption that the population variances are known (rarely true). For large samples, sample variances approximate population variances, so TD_ZTest uses sample variances instead of population variances in the test statistic.

Assumptions

  • Sample distribution is normal.
  • Data is numeric, not categorical.

Test Type

  • One-tailed or two-tailed (your choice)
  • One-sample or two-sample (your choice)

    Use one-sample to test whether the mean of a population is greater than, less than, or not equal to a specific value. TD_ZTest compares the critical values of the normal distribution at levels of significance (alpha = 0.01, 0.05, 0.10) to the Z-test statistic.

  • Unpaired

Computational Method

A test of the hypothesis involves the following framework:
  1. A null hypothesis H0 and an alternative hypothesis H1
  2. A random sample x1, x2,....xn in the case of a one sample test
  3. Two random samples x1, x2,....xn and y1, y2,....yn in the case of a two sample test
  4. A test statistic Zstat
  5. A level of significance α ϵ {0.10, 0.05, 0.01}
  6. Compare the sample based Zstat with the percentage point of the normal distribution |ᴢ| or |ᴢ α/2|
  7. Compute the p-value
  8. Conclusion

The Z-test is commonly used in situations where the sample size is large (typically greater than 30) and the population standard deviation is known. The steps involved in performing a Z-test include defining the null and alternative hypotheses, calculating the test statistic, determining the critical value or p-value, and making a decision about whether to reject or fail to reject the null hypothesis based on the level of significance chosen for the test.

Some uses of TD_ZTest include:
  • Medical research: A pharmaceutical company wants to test the effectiveness of a new drug on blood pressure. The company can use TD_ZTest to determine whether the mean blood pressure of patients who took the drug is significantly different from the mean blood pressure of patients who received a placebo.
  • Marketing research: A company wants to determine if there is a significant difference in the mean sales of two different products. The company can use TD_ZTest to determine whether the difference in means is statistically significant.
  • Quality control: A manufacturer wants to test whether a new production process results in a different mean defect rate than the previous process. The manufacturer can use TD_ZTest to compare the mean defect rate of the two processes.
  • Education research: A researcher wants to determine whether there is a significant difference in the mean test scores of two groups of students who received different teaching methods. The researcher can use TD_ZTest to compare the mean test scores of the two groups.
  • Finance research: A stock analyst wants to test whether the mean return of a particular stock is significantly different from the mean return of the market as a whole. The analyst could use a Z-test to compare the mean returns of the stock and the market.

TD_ZTest provides valuable insights for decision-making in a wide range of contexts. TD_ZTest is a useful tool in statistical analysis for determining whether there is a significant difference between two population means, and it can provide valuable insights for researchers and analysts.

Z-test Formula

Z = (x̄1 - x̄2) / (σ / √n)

where:
  • x̄1 and x̄2 are the means of the two samples you want to compare
  • σ is the standard deviation of the population
  • n is the sample size of each group

TD_ZTest Use with Scalar Values

You can use TD_ZTest to compare the heights of two different groups of people. You take a random sample of 25 people from each group, and you find that the mean height of Group 1 is 68 inches and the mean height of Group 2 is 72 inches. You also know that the standard deviation of the population is 3 inches.

Using the formula:

  • Z = (x̄1 - x̄2) / (σ / √n)
  • Z = (68 - 72) / (3 / √25)
  • Z = -4 / 0.6
  • Z = -6.67

This Z-score indicates that the difference between the two sample means is large and statistically significant. To determine the level of significance and whether to reject or fail to reject the null hypothesis, we would compare this Z-score to a critical value from a Z-table or calculate the p-value associated with this Z-score using statistical software.

TD_ZTest Use with Vector Values

You can use TD_ZTest to test whether the means of two or more vectors are significantly different from each other. In this case, it involves computing the mean and standard deviation of the combined vector.

Suppose you have two vectors of values representing the test scores of two different classes of students. The first vector contains the scores of Class A, and the second vector contains the scores of Class B.

Here are the test scores of Class A: [75, 80, 85, 90, 95]

Here are the test scores of Class B: [60, 65, 70, 75, 80]

To test whether there is a significant difference between the mean test scores of these two classes, you can use the TD_ZTest for two vectors.

Compute the mean and standard deviation of the combined vector:

Mean: (75 + 80 + 85 + 90 + 95 + 60 + 65 + 70 + 75 + 80) / 10 = 77.5

Standard deviation: 10.7 (calculated using a spreadsheet software or calculator)

Compute the Z-score:

Z = (x̄1 - x̄2) / (σ / √n)

Z = (82.5 - 70) / (10.7 / √5)

Z = 2.68

Use a Z-table or statistical software to determine the p-value associated with this Z-score.