Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • Compute Services
  • System Modeler
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

Wolfram Consulting

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Notebook Assistant + LLM Kit
    • Compute Services
    • System Modeler
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
ZTest
  • See Also
    • HypothesisTestData
    • LocationTest
    • LocationEquivalenceTest
    • VarianceTest
    • VarianceEquivalenceTest
    • DistributionFitTest
    • MannWhitneyTest
    • PairedTTest
    • PairedZTest
    • SignTest
    • SignedRankTest
    • TTest
  • Related Guides
    • Hypothesis Tests
    • See Also
      • HypothesisTestData
      • LocationTest
      • LocationEquivalenceTest
      • VarianceTest
      • VarianceEquivalenceTest
      • DistributionFitTest
      • MannWhitneyTest
      • PairedTTest
      • PairedZTest
      • SignTest
      • SignedRankTest
      • TTest
    • Related Guides
      • Hypothesis Tests

ZTest[data]

tests whether the mean of the data is zero.

ZTest[{data1,data2}]

tests whether the means of data1 and data2 are equal.

ZTest[dspec,σ2]

tests for zero or equal means assuming a population variance σ2.

ZTest[dspec,σ2,μ0]

tests the mean against μ0.

ZTest[dspec,σ2,μ0,"property"]

returns the value of "property".

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Testing  
Reporting  
Options  
AlternativeHypothesis  
SignificanceLevel  
VerifyTestAssumptions  
Applications  
Properties & Relations  
Possible Issues  
Neat Examples  
See Also
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • HypothesisTestData
    • LocationTest
    • LocationEquivalenceTest
    • VarianceTest
    • VarianceEquivalenceTest
    • DistributionFitTest
    • MannWhitneyTest
    • PairedTTest
    • PairedZTest
    • SignTest
    • SignedRankTest
    • TTest
  • Related Guides
    • Hypothesis Tests
    • See Also
      • HypothesisTestData
      • LocationTest
      • LocationEquivalenceTest
      • VarianceTest
      • VarianceEquivalenceTest
      • DistributionFitTest
      • MannWhitneyTest
      • PairedTTest
      • PairedZTest
      • SignTest
      • SignedRankTest
      • TTest
    • Related Guides
      • Hypothesis Tests

ZTest

ZTest[data]

tests whether the mean of the data is zero.

ZTest[{data1,data2}]

tests whether the means of data1 and data2 are equal.

ZTest[dspec,σ2]

tests for zero or equal means assuming a population variance σ2.

ZTest[dspec,σ2,μ0]

tests the mean against μ0.

ZTest[dspec,σ2,μ0,"property"]

returns the value of "property".

Details and Options

  • ZTest tests the null hypothesis against the alternative hypothesis :
  • data
    {data1,data2}
  • where μi is the population mean for datai.
  • By default, a probability value or -value is returned.
  • A small -value suggests that it is unlikely that is true.
  • The data in dspec can be univariate {x1,x2,…} or multivariate {{x1,y1,…},{x2,y2,…},…}.
  • Given one dataset, the argument σ2 can be any positive real number or a positive definite matrix with dimension equal to the dimension of data.
  • Given two datasets, the argument σ2 can be any positive real number, a positive definite matrix with dimension equal to the dimension of dspec, or two such numbers or matrices.
  • The argument μ0 can be a real number or a real vector with length equal to the dimension of the data.
  • ZTest assumes that the data is normally distributed and that the variance is known and not estimated from the data.
  • If variances or covariance matrices are not provided, ZTest treats the sample estimate as the known variance or covariance.
  • ZTest[dspec,σ2,μ0,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
  • ZTest[dspec,σ2,μ0,"property"] can be used to directly give the value of "property".
  • Properties related to the reporting of test results include:
  • "DegreesOfFreedom"the degrees of freedom of a test
    "PValue"list of -values
    "PValueTable"formatted table of -values
    "TestData"list of pairs of test statistics and -values
    "TestDataTable"formatted table of -values and test statistics
    "TestStatistic"list of test statistics
    "TestStatisticTable"formatted table of test statistics
  • If a known variance σ2 is not provided, ZTest performs a -test assuming the sample variance is the known variance for univariate data, and Hotelling's test assuming the sample covariance is the known covariance for multivariate data.
  • Options include:
  • AlternativeHypothesis "Unequal"the inequality for the alternative hypothesis
    SignificanceLevel 0.05cutoff for diagnostics and reporting
    VerifyTestAssumptions Allwhat assumptions to verify
  • For tests of location, a cutoff is chosen such that is rejected if and only if . The value of used for the "TestConclusion" and "ShortTestConclusion" properties is controlled by the SignificanceLevel option. This value is also used in diagnostic tests of assumptions, including tests for normality, equal variance, and symmetry. By default, is set to 0.05.
  • Named settings for VerifyTestAssumptions in ZTest include:
  • "Normality"verify that all data is normally distributed

Examples

open all close all

Basic Examples  (4)

Test for zero mean, assuming a known variance of 1:

The mean of the dataset:

Compare the means of two populations, assuming known variances of 4 and 16:

The means are significantly different:

Compare the mean vectors of two multivariate populations:

Compare the mean vector of a multivariate population to {1,2,3}:

The difference is significant:

Scope  (17)

Testing  (14)

Set the known variance to 1:

Setting the known variance to Automatic is equivalent to using the sample variance:

The result is the same:

Specify a single common variance for two groups, or give a list of variances:

For multivariate data, covariance matrices can be given:

A single group covariance:

Separate covariance matrices for each dataset:

Test versus :

The -values are typically large when the mean is close to mu_(0):

The -values are typically small when the location is far from mu_(0):

Using Automatic is equivalent to testing for a mean of zero:

Test versus :

The -values are typically large when the mean is close to μ0:

The -values are typically small when the location is far from μ0:

Test whether the mean vector of a multivariate population is the zero vector:

Alternatively, test against {0.1,0,-0.05,0}:

Test versus :

The -values are generally small when the locations are not equal:

The -values are generally large when the locations are equal:

Test versus :

The order of the datasets affects the test results:

Test whether the mean difference vector of two multivariate populations is the zero vector:

Alternatively, test against {1,0,-1,0}:

Create a HypothesisTestData object for repeated property extraction:

The properties available for extraction:

Extract some properties from a HypothesisTestData object:

The -value and test statistic:

Extract any number of properties simultaneously:

The -value and test statistic:

Reporting  (3)

Tabulate the test results:

Retrieve the entries from a test table for customized reporting:

Tabulate -values or test statistics:

The -value from the table:

The test statistic from the table:

Options  (9)

AlternativeHypothesis  (3)

A two-sided test is performed by default:

Test versus :

Perform a two-sided test or a one-sided alternative:

Test versus :

Test versus :

Test versus :

Perform tests with one-sided alternatives when μ0 is given:

Test versus :

Test versus :

SignificanceLevel  (2)

Set the significance level for diagnostic tests:

By default, 0.05 is used:

The significance level is also used for "TestConclusion" and "ShortTestConclusion":

VerifyTestAssumptions  (4)

Control whether to verify the assumption of normality:

Assume normality:

Check for normality:

Alternatively:

Unlisted assumptions are not tested:

Normality is assumed:

The result is the same but a warning is issued:

Bypassing diagnostic tests can save compute time:

It is often useful to bypass diagnostic tests for simulation purposes:

The assumptions of the test hold by design, so a great deal of time can be saved:

The results are identical:

Applications  (1)

A factory creates 10-inch fuse casings on two separate lines. The length of these casings has a known variance of 0.005 inches squared. In a quality control test, 25 casings were randomly selected from each of the two lines. A line is shut down and recalibrated if there is a significant deviation from 10 inches:

The first line performs as expected; the second needs to be recalibrated:

Suppose it is known that the factory machinery produces longer casings after prolonged use. The one-sided alternative "Greater" is appropriate:

Properties & Relations  (6)

The univariate test statistic for one sample:

The test statistic follows a NormalDistribution[0,1] under :

The multivariate test statistic for one sample:

Under , zChiSquareDistribution[p] where p is the dimension of the data:

If variance is not specified, the test statistic is equivalent to that of TTest:

The -values are not equivalent:

In general, ZTest is more powerful than TTest:

ZTest works with the values only when the input is a TimeSeries:

ZTest works with all the values together when the input is a TemporalData:

Test all the values only:

Test whether the means of the two paths are equal:

Possible Issues  (2)

The test statistic does not follow a NormalDistribution[0,1] if the sample variance is used:

TTest gives the appropriate -value when the sample variance is used:

The data should follow a NormalDistribution:

Use median-based tests if the data is not normally distributed:

LocationTest will pick an appropriate test automatically:

Neat Examples  (1)

Compute the statistic when the null hypothesis is true:

The test statistic given a particular alternative:

Compare the distributions of the test statistics:

See Also

HypothesisTestData  LocationTest  LocationEquivalenceTest  VarianceTest  VarianceEquivalenceTest  DistributionFitTest  MannWhitneyTest  PairedTTest  PairedZTest  SignTest  SignedRankTest  TTest

Related Guides

    ▪
  • Hypothesis Tests

History

Introduced in 2010 (8.0)

Wolfram Research (2010), ZTest, Wolfram Language function, https://reference.wolfram.com/language/ref/ZTest.html.

Text

Wolfram Research (2010), ZTest, Wolfram Language function, https://reference.wolfram.com/language/ref/ZTest.html.

CMS

Wolfram Language. 2010. "ZTest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ZTest.html.

APA

Wolfram Language. (2010). ZTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ZTest.html

BibTeX

@misc{reference.wolfram_2025_ztest, author="Wolfram Research", title="{ZTest}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/ZTest.html}", note=[Accessed: 01-April-2026]}

BibLaTeX

@online{reference.wolfram_2025_ztest, organization={Wolfram Research}, title={ZTest}, year={2010}, url={https://reference.wolfram.com/language/ref/ZTest.html}, note=[Accessed: 01-April-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English