Inference

Ready to explore your quantitative or categorical data? Add a probability distribution or run an inference test from the Inference menu with just a few clicks.

For quantitative (numerical) data, choose betwen a \(z\)-test or \(t\)-test. For categorical data, choose between a \(z\)-test for proportions and a chi-square \((\chi^2)\) test — a \(\chi^2\) test for independence or a \(\chi^2\) goodness of fit test.

Learn more about distributions in our Probability Distributions article.

Screenshot of the Inference Menu.

 

To get started, click Add Item and then Inference. Or, type inference directly in the expression list.

Choose the test you want to run, enter your data, and click Create Test. The menu will then close and automatically add the test to an expression line. The line will include the following sections:

  • Confidence Interval: For \(z\)-tests, \(t\)-tests, and \(z\)-tests for proportions.
  • Observed (Expected): For chi-square tests for independence and chi-square goodness of fit tests.
  • Significance Test: Included with all tests.
Screenshot of a t-test with list of data -1,2,3. The screenshot shows entering the data in the Inference Menu as well as the results of the entry with Confidence Interval and Significance Test sections open.

 

Confidence Intervals

The Confidence Interval section includes the confidence level, which defaults to \(0.95\). This means that if you continued to run random samples of the same size from the same population, \(95\%\) of the confidence intervals created would contain the true population parameter.

You can adjust the level manually or by using a slider to explore how changes to the confidence level affect the bounds of the confidence interval.

Click More on the diagram to export any of the following components to the expression list:

Name Function Definition
Lower Bound .conf(0.95).lower Lower bound of the confidence interval
Upper Bound .conf(0.95).upper Upper bound of the confidence interval
Point Estimate .estimate Best estimate of the true mean of the population
Standard Error .stderr Standard deviation of the sampling distribution

 

Significance Tests

Open the Significance Test section to view a significance diagram that shows the distribution for your test, the test statistic, the degrees of freedom, and the shaded \(p\)-value area.

For \(z\)-tests, \(t\)-tests, or \(z\)-tests for proportions, you can adjust the null hypothesis. You can also toggle between Tails options to test against different alternative hypotheses:

Screenshot of a ttest on the list -1, 2, 3. The Significance Test section is open with the left tail chosen.

Left: Shades the area to the left of the test statistic. This represents the probability of observing a value less than what is actually observed in the sample data, assuming the null hypothesis is true.

Screenshot of a ttest on the list -1, 2, 3. The Significance Test section is open with the both tail chosen by default.

Both (default): Shades the area with larger absolute value than the test statistic. This represents the probability of observing a larger absolute value than what is actually observed in the sample data, assuming the null hypothesis is true.

Screenshot of a ttest on the list -1, 2, 3. The Significance Test section is open with the right tail chosen.

Right: Shades the area to the right of the test statistic. This represents the probability of observing a value greater than what is actually observed in the sample data, assuming the null hypothesis is true.

Click More on the significance diagram to export the following values:

Name Function Definition
Degrees of freedom .dof The number of independent observations in the data (Not used for a \(z\)-test)
Test statistic .score The value calculated from your sample data that quantifies how much the observed data deviates from the expected values under the null hypothesis
\(p\)-value .p The probability of observing something at least as extreme as the sample data, assuming the null hypothesis is true.

For \(z\)-tests, \(t\)-tests, and \(z\)-tests for proportion, the \(p\)-value for the left tail is .pleft, and the \(p\)-value for the right tail is .pright.

 

You can also export the significance diagram itself to the graph. Doing so will export the test statistic to an expression line and will automatically zoom to fit the distribution.

 

Tests for Quantitative Data

Quantitative data is measured numerically. For quantitative data, choose between a \(z\)-test and \(t\)-test. Both tests use the mean of a sample to estimate a likely range for the population mean and test whether the sample mean differs significantly from a hypothesized population mean. Use a \(z\)-test if the population standard deviation is known. Otherwise, use a \(t\)-test. For either test, enter your data either as a list of values or with summary statistics.

 

Example One-Sample \(z\)-test

To perform a one-sample \(z\)-test, enter a list of data in the Data tab or summary statistics in the Stats tab.

For example, if you enter the values \(1,2,3\) and a population standard deviation of \(0.5\), clicking Create Test will add ztest([1,2,3],.5) to the expression list, along with Confidence Interval and Significance Test sections.

GIF using the Inference menu to enter data 1,2,3 and and a population standard deviation of 0.5 to run a ztest. Clicking Create Test generates the test in the expression list with Confidence Interval and Significance Test sections. The GIF opens the confidence interval section.

 

Example Two-Sample \(t\)-test

To perform a two-sample t-test, you can enter two lists of data manually in the Data tab or summary statistics in the Stats tab. Or, you can use two lists of data you’ve already created in the expression list.

For example, if you have two pre-existing lists, \(L_1\) and \(L_2\) you can enter \(L_1\) for Sample 1. Then, click Sample 2 and enter \(L_2\). Clicking Create Test will add ttest\((L_1,L_2)\) to the expression list, along with Confidence Interval and Significance Test sections.

Gif starting with two lists L1 and L2 in the expression list. The GIF shows entering these lists in the ttest section of the Inference Menu and shows the result of clicking create test. It ends by opening the Significance Test section and exporting the Significance Diagram to the graph paper.

 

Example \(t\)-test for the Slope of a Regression Line

To perform a \(t\)-test for the slope of a regression line, start with a linear regression of sample data. This test estimates a likely range for the population slope and checks whether the sample data differs significantly from a hypothesized slope.

You can either type a custom linear regression or add a regression template. Then, export the linear regression as a custom model. Read more in our Regressions article.

For example, if your linear regression has parameter \(m\), typing ttest\((m)\) will show the Confidence Level and Significance Test sections. You can change the hypothesized slope in the Significance Test section.

GIF walking through creating a linear regression for a set of data and then running a t-test on the slope parameter.

 

Tests for Categorical Data

Categorical data is grouped into distinct categories, unlike quantitative data, which is measured numerically. For categorical data, choose from the following tests:

  • \(z\)-test for proportion: Estimates a likely range for the true population proportion based on the sample proportion and checks whether the sample proportion differs significantly from a hypothesized proportion.
  • Chi-square test of independence: Determines if two categorical variables are related.
  • Chi-square goodness of fit test: Compares observed data for a single categorical variable to an expected distribution.

 

Example \(z\)-test for Proportions

To perform a \(z\)-test for proportions, enter the number of successes and the sample size in the Inference menu.

For example, if you enter \(45\) for the number of successes and \(80\) for the sample size, clicking Create Test will add zproptest\((45, 80)\) to the expression list, along with Confidence Interval and Significance Test sections.

Screenshot of a zproptest with 45 successes and 80 trials. The Confidence Interval and Significance Test sections are both open with the Significance Diagram exported.

 

Example Chi-square \((\chi^2)\) Tests

Chi-square Test of Independence

To perform a chi-square test of independence, enter your data in a two-way table. Enter one variable across the columns (Group 1, Group 2, etc. ) and the other down the rows (Group A, Group B, etc.). Add more data by clicking into the next cell of the table.

For example, if you enter \(15, 5, 10, 10\) in the first column and \(15, 15, 15, 15\) in the second column, clicking Create Test will add chisqtest\(([15,5,10,10],[15,15,15,15])\) to the expression, along with Observed (Expected) and Significance Test sections.

GIF entering data into the chi-square test of independence in the Inference menu. The GIF shows entering 15,5,10,10 in the first column and 15,15,15,15 in the second column. Clicking create test populates the expression list and the Observed(Expected) and Significance Test sections are opened.

 

Chi-square Goodness of Fit

To perform a chi-square goodness of fit test, enter your observed values in the first column. You can optionally add expected values in the second column. If the Expected column is left blank, a uniform distribution is assumed (each entry is expected to have the same value).

For example, if you enter \(30, 20, 25, 25\) to the Observed column and leave the Expected column blank, clicking Create Test will add chisqgof([30,20,25,25]) to the expression list, along with Observed (Expected) and Significance Test sections.

GIF entering data into the chi-square goodness of fit test in the Inference menu. The GIF shows entering 30,20,25,25 in the Observed column and leaves the Expected Column blank. Clicking create test populates the expression list and the Observed(Expected) and Significance Test sections are opened. The Significance Diagram is then exported to the graph paper.

 

For both chi-square tests, the Observed (Expected) section includes a table with your entered data, along with three checkboxes:

  • Expected (default): Shows expected values in parentheses.
  • Contributions:
    • For the chi-square test of independence, this option highlights each cell based on its contribution to the chi-square test statistic.
    • For the chi-square goodness of fit test, this option adds a new column showing each entry’s contribution to the chi-square test statistic.
  • Totals:
    • For the chi-square test of independence, this option shows row and column totals.
    • For the chi-square goodness of fit test, this option sums the count column. If you’ve also selected Contributions, the Totals option will sum the contributions as well (which equals the overall chi-square statistic).

 

Learn More

Please write in with any questions or feedback to support@desmos.com.