Chapter 7 AppendixInference for Distributions with Excel, JMP, Minitab, SPSS, CrunchIt!, R, and TI-83/-84 Calculators

TA7-1

Inference for the Mean of a Population

image

Confidence Interval for Mean

Confidence intervals are available only with the Analysis Toolpak add-in, and only with raw data.

  1. Data Analysis ➔ Descriptive Statistics
  2. In the “Input Range” section, enter or select the range of data.
  3. Check the box for “Confidence Level for Mean” and enter desired confidence level.

Test for Population Mean

Excel does not provide a dedicated statistical routine for testing the mean of a population.

Matched Pairs Test

  1. Data Analysis ➔ Test: Paired Two-Sample for Means
  2. Select or enter the range of cells for the first variable—the first observation from each pair.
  3. Select or enter the range of cells for the second variable—the second observation from each pair.
  4. Enter a hypothesized mean difference, usually 0.
  5. Click “OK.”

For more help and examples, see the Excel Video Technology Manuals on One-Sample Mean Inference: t - summarized data, One-Sample Mean Inference: t - with data, and Paired Samples Inference.

image

Confidence Interval for Mean

  1. Analyze ➔ Distribution
  2. Select a numeric column or columns of interest and click “Cast into the Y role”; click “OK.”
  3. Confidence intervals are shown in the summary statistics section as Lower and Upper 95% Mean.
  4. To change the confidence level, select the red triangle next to the variable name ➔ Confidence Interval. This allows 90%, 95%, and 99%, or click “Other” and enter a different confidence level.

Test for Population Mean

  1. Analyze ➔ Distribution
  2. Select a numeric column and click “Y, Columns” to enter this variable in the Y role.
  3. Select the red triangle and click “Test Mean.”
  4. Enter the hypothesized value of the mean.
  5. Click “OK.”

TA7-2

Matched Pairs Test

  1. Analyze ➔ Matched Pairs
  2. Select the two numeric columns with paired data and click “Y, Paired Response” to enter both variables in the Y role.
  3. Click “OK.”

For more help and examples, see the JMP Video Technology Manuals on One Mean Test - t Test - summarized data, One Mean Test - t Test - with data, One-Sample Mean Inference: t - with data, One-Sample Mean Inference: t - summarized data, and Paired Samples Inference.

image

Confidence Interval and Tests for One-Sample Mean

Confidence intervals and tests are done from the same dialog box regardless of whether you have raw data (in a column) or only summary statistics.

  1. Stat ➔ Basic Statistics ➔ One-Sample t
  2. Change the drop-down at the top to reflect whether you have summary statistics or raw data in a column.
  3. For raw data, highlight and select the column name into the box.
  4. For summary statistics, enter the sample size (n), sample mean (), and standard deviation ().
  5. The defaults are 95% confidence and a “not equal” alternate (two-sided confidence interval). To change either of these, click “Options,” change the value, then click “OK.”
  6. For the confidence interval, click “OK.”
  7. For a hypothesis test, check the box and enter the value of , then click “OK.”

Matched Pairs Test and Confidence Interval

Output here includes the test statistic for Group 1 – Group 2, as well as the confidence interval for the mean difference. Paired data must be in two separate columns.

  1. Stat ➔ Basic Statistics ➔ One-Sample t
  2. Change the drop-down at the top to reflect whether you have summary statistics or raw data in a column.
  3. For raw data, highlight and select the column name into the box
  4. For summary statistics, enter the sample size (n), sample mean (), and standard deviation ().
  5. The defaults are 95% confidence and a “not equal” alternate (two-sided confidence interval). To change either of these, click “Options,” change the value, then click “OK.”
  6. Click “OK” to find the results.

For summary statistics, enter the sample size (n), sample mean (), and standard deviation ().

For more help and examples, see the Minitab Video Technology Manuals on One-Sample Mean Inference: t - with data, One-Sample Mean Inference: t - summarized data, and Paired Samples Inference.

TA7-3

image

Confidence Interval for Mean

  1. Analyze ➔ Descriptive Statistics ➔ Explore
  2. Select the column of interest and press the arrow to enter the column into the “Dependent List.”
  3. Click “Statistics” to set options, including confidence level.
  4. Click “OK.”

Test for Population Mean

  1. Analyze ➔ Compare Means ➔ One-Sample Test
  2. Select the column of interest and press the arrow to enter the column into the “Test Variable(s)” section.
  3. Enter the hypothesized mean in the “Test Value” section.
  4. Click “OK.” The “Confidence Interval for the Difference” in the output is for the difference .

Matched Pairs Test and Confidence Interval

Output here includes the test statistic for Group 1 – Group 2, as well as the confidence interval for the mean difference. Paired data must be in two separate columns.

  1. Analyze ➔ Compare Means ➔ Paired-Sample Test
  2. Select the two columns of interest (paired responses) and press the arrow to enter the columns in to the “Paired Variable” section. If you want to change the confidence level, click “Options” and enter the desired value.
  3. Click “OK.”

For more help and examples, see the SPSS Video Technology Manuals on One-Sample Mean Inference: t - with data and Paired Samples Inference.

image

Both confidence intervals and hypothesis tests are done through the Statistics ➔ t ➔ One-Sample dialog,

  1. For “raw data” in a column, click the “Columns” tab; otherwise, click “Summarized.”
  2. For raw data, select the column of interest.
  3. For summarized data, enter the sample size (n), observed sample mean, and sample standard deviation.
  4. Select the “Confidence Interval” tab and enter the desired confidence level.
  5. Select the “Hypothesis Test” tab. Enter the hypothesized mean value and type of alternate hypothesis.
  6. Click “Calculate.”

Matched Pairs

  1. Statistics ➔ t ➔ Paired
  2. Select the first and second variable.
  3. Select the “Hypothesis Test” tab or “Confidence Interval” tab.
  4. For a test, enter the mean difference under the null hypothesis and type of alternate hypothesis. For an interval, enter the desired confidence level.
  5. Click “Calculate.”

For more help and examples, see the CrunchIt! Help Videos on Confidence Intervals Using t, One Mean Test Using t, and Paired Samples Inference.

TA7-4

image

Confidence Interval for Mean

  1. Press image image to select “TEST.”
  2. Select 8:TInterval.
  3. Select “Data” (you have entered the actual sample data in a list) or “Stats.”
  4. For raw data, enter L1 (or whichever list has your data) as the data location and the confidence level.
  5. For summarized data (you have Stats), enter the sample mean (), the sample standard deviation (), the sample size (), and the confidence level.
  6. Select “Calculate.”

Test for Population Mean

  1. Press image image to select “TEST.”
  2. Select 2:T-test.
  3. Select “Data” (you have entered the actual sample data in a list) or “Stats.”
  4. Enter the value of the mean under the null hypothesis.
  5. For raw data, enter L1 (or whichever list has your data) as the data location.
  6. For summarized data (you have Stats), enter the sample mean, sample standard deviation, and sample size.
  7. Select the desired type of alternative hypothesis.
  8. Select “Calculate.”

Matched Pairs Test

  1. Enter the data in L1 and L2.
  2. Move to the top of L3 and enter L1–L2; this will calculate difference scores for each row (press to enter the computation).
  3. Press image image to select “TEST.”
  4. Select 2:T-test.
  5. Select “Data” (or “Stats” to enter summary statistics for the differences), enter L3 as the data location, and select alternative hypothesis.
  6. Select “Calculate.”

For more help and examples, see the TI Video Technology Manuals on One-Sample Mean Inference: t - with data, One-Sample Mean Inference: t - summarized data, and Paired Samples Inference.

image

Inference for One Mean

Both confidence intervals and hypothesis tests are done through the t.test command

> t.test(var, alternative= ‘two.sided’, mu=15, conf.level=.95,data=dataframe)

where “var” is the name of the variable that is part of the “dataframe” data set; possible alternatives are “two.sided,” “less,” or “greater,” If the “mu = ” portion is omitted, a test against a mean of 0 is computed by default, but this allows computation of just the confidence interval.

TA7-5

Matched Pairs Test

Both confidence intervals and hypothesis tests are done through the t.test command—note the addition of “Paired-T” in the command

> t.test(x,y,alternative=“two.sided”,paired=T,conf.level=
0.95,data=mydat)

For more help and examples, see the R Video Technology Manuals on Inference for a Population Mean Based on t Using Raw Data, Significance Test for a Population Mean Based on t Using Summarized Data, and Paired Samples Inference.

Comparing Two Means

image

  1. Data Analysis ➔ t test: Two-Sample Assuming Equal Variances
           or ➔ t test: Two-Sample Assuming Unequal Variances
  2. Select or enter the range of cells for the first variable.
  3. Select or enter the range of cells for the second variable.
  4. Enter a hypothesized mean difference, usually 0.
  5. Click “OK.”

Excel does not automatically calculate the confidence interval for the difference in means.

For more help and examples, see the Excel Video Technology Manuals for Two-Sample Mean Inference : t - summarized data and Two-Sample Mean Inference: t - with data.

image

This procedure requires that all response variables values be in one column and a “sample identifier” (factor) in a second column.

  1. Analyze ➔ Fit Y by X
  2. Select the numeric response column and click “Y, Response” to enter this variable in the Y role.
  3. Select the categorical factor and click “X, Factor” to enter this variable in the X role.
  4. Click “OK.”
  5. Click the red triangle and select “Means/ANOVA/Pooled t” for a test assuming equal variances, or “ test” for a test assuming unequal variances.

JMP does not calculate and display the confidence interval for the difference in means, but it does give the standard error of the difference and degrees of freedom in its results.

For more help and examples, see the JMP Video Technology Manual for One-Sample Mean Inference: t - with data.

TA7-6

image

Stat ➔ Basic Statistics ➔ Two-Sample t

There are three ways to enter the data:

  • If the data for the two samples are in two separate columns, then choose “Each sample is in its own column” and click in the two columns of data.
  • If the data for the two samples are in one column with a group label (sample ID) in second column, choose “Both samples are in one column” and click in the samples column and sample IDs column.
  • If you know the values of the sample means and sample standard deviations, you can choose the “Summarized data” option and input the sample sizes, sample means, and sample standard deviations in the boxes.

The default is not to assume equal population variances. If you wish to assume equal population variances, select “Options,” and then check the box for “Assume equal variances.”

If you wish to change the level of confidence (from the default of 95%) or the form of the alternate hypothesis (the default is “not equal”), click “Options” and input your desired values.

Minitab displays a confidence interval that corresponds to the alternate hypothesis with the test results.

For more help and examples, see the Minitab Video Technology Manuals on Two Sample Mean Inference: t - with data and Two Sample Mean Inference: t - summarized data, and Paired Samples Inference.

image

Comparing Two Means—with Data

  1. Analyze ➔ Compare Means ➔ Independent-Samples Test
  2. There are two ways to enter data. If the two samples are in separate columns, select the two columns of interest and press the arrow to enter the columns in to the “Test Variables” section.
  3. If you have one column of data and a numeric group (sample) identifier, enter the data variable name into the “Test Variables” section and the grouping variable into the “Grouping Variable” box. You will then have to click “Define Groups” and supply the labels for “Sample 1” and “Sample 2.”
  4. The default is to provide the test statistic, -value, and a 95% confidence interval. For a different confidence level, click “Options” and change to the level you want.
  5. Click “OK.”

Comparing Two Means—with Summary Statistics (requires Python Plug-in)

  1. Analyze ➔ Compare Means ➔ Summary Independent-Samples Test
  2. Enter the summary statistics for each sample and the confidence level.
  3. Click “OK.”

For more help and examples, see the SPSS Video Technology Manuals for Two-Sample Mean Inference: t - with data.

TA7-7

image

  1. Statistics ➔ t ➔ Two-sample
  2. Select either “Columns” (for data in separate columns), “Grouped” (for data in one column, and a group ID in another column), or “Summarized” (to enter summary statistics).
  3. Enter in the columns or values necessary.
  4. Select “Pooled Variance” to perform a test assuming equal population variances.
  5. Select the “Hypothesis Test” tab.
  6. Enter the mean difference under the null hypothesis.
  7. Select the desired type of alternative hypothesis.
  8. Click “Calculate.”

For more help and examples, see the CrunchIt Help Video on Two Sample Mean Inference.

image

  1. Enter the data in L1 and L2.
  2. Press image image to select “TEST.”
  3. Select 4:2-SampTTest or 0:2-SampTInt.
  4. Select “Data” (or “Stats” to enter summary statistics) and enter L1 and L2 as the data location.
  5. For the test, enter the form of the alternate hypothesis; for the interval, enter the confidence level.
  6. For Pooled, No is typical (Yes assumes equal variances).
  7. Select “Calculate.”

For more help and examples, see the TI-83/-84 Video Technology Manuals for Two-Sample Mean Inference: t - with data and Two-Sample Mean Inference: t - summarized data.

image

The R command for a test and confidence interval is the same as for the paired test, but omitting the “paired=T” part.

> t.test(x,y,alternative=“two.sided”,conf.level=
0.95,data=mydat)

For more help and examples, see the R Video Technology Manuals on Two-Sample Mean Inference with Raw Data and Two-Sample Mean Inference with Summarized Data.

Additional Topics on Inference

image

Power (One-Sample )

Automated power calculations are not available in Excel. The Normal distribution can be used to compute the approximate power. Accordingly, you can use Excel’s NORMSDIST function to compute probabilities from the Normal distribution.

Sign Test

The sign test is not available in Excel.

Power (Two-Sample )

Automated power calculations are not available in Excel.

TA7-8

image

Power (One-Sample )

  1. DOE ➔ Sample Size and Power ➔ One-Sample Mean (if you do not have a DOE menu, enter the JMP preferences, select “Menu,” and check the box for “Design of Experiments”).
  2. Enter a value for alpha and the population standard deviation.
  3. Supply two values in the table and “Continue” to calculate the third.
  4. Select “Animation Script” to view an interactive visualization of power.

Sign Test

  1. Analyze ➔ Matched Pairs
  2. Select the two numeric columns with paired data and click “Y, Paired Response” to enter both variables in the Y role.
  3. Click “OK.”
  4. Click the red triangle and select “Sign Test.”

Power (Two-Sample )

  1. DOE ➔ Sample Size and Power ➔ Two-Sample Means (if you do not have a DOE menu, enter the JMP preferences, select “Menu,” and check the box for “Design of Experiments”).
  2. Enter a value for alpha and the population standard deviation.
  3. Supply two values in the table and “Continue” to calculate the third.

image

Power (One-Sample )

Stat ➔ Power and Sample Size ➔ One-Sample t

This is nearly identical to finding the power of a one-sample test discussed in Chapter 6. The only difference is that, in the Standard deviation box, you need to enter an estimate of the population standard deviation (). For a matched pairs study, enter the estimated standard deviation of the differences between the pairs.

Sign Test

  1. Compute the differences. At the MTB> prompt (enable this by clicking in the Session window, then clicking Edit ➔ Enable Commands), let where is an empty column to receive the differences, and and are the data columns.
  2. Stat ➔ Nonparametrics ➔ 1-Sample Sign
  3. Click in the column containing the differences into the box.
  4. Select “Test Median” and enter a value to test (usually 0).

Power (Two-Sample )

Stat ➔ Power and Sample Size ➔ Two-Sample t

Note: This routine is essentially identical to the routine for finding the power of a one-sample test. This routine assumes:

  • The two sample sizes (n1 and n2) are equal—enter only one
  • The standard deviations of the two populations are equal

TA7-9

image

Power (One-Sample )

SPSS does not have dedicated routines for calculating power.

Sign Test

  1. Analyze ➔ Nonparametric Tests ➔ Legacy Dialogs ➔ Two Related Samples
  2. Select the outcome variables of interest and press the arrow to enter the columns in to the “Test Variable(s)” section.
  3. In the “Test type” box, check “Sign.”
  4. Click “OK.”

image

Power (One-Sample )

To determine power:

  1. Statistics ➔ Power Analysis ➔ Calculate Power
  2. Enter in values for alpha, the size of the effect, the population standard deviation, and the sample size.
  3. Select the type of alternative hypothesis.
  4. Click “Calculate.”

To determine sample size:

  1. Statistics ➔ Power Analysis ➔ Calculate Sample Size
  2. Enter values for alpha, the size of the effect, the population standard deviation, and the desired power.
  3. Select the type of alternative hypothesis.
  4. Click “Calculate.”

Sign Test

  1. Statistics ➔ Non-parametrics ➔ Sign Test
  2. Select the first and second variable.
  3. Enter the difference under the null hypothesis.
  4. Select the desired type of alternative hypothesis.
  5. Click “Calculate.”

Power (Two-Sample )

Power for two-sample tests is not available in CrunchIt.

image

Power (Two-Sample )

There is no dedicated routine for calculating power on the TI-83.

TA7-10

image

Power (One-Sample )

Enter any three of the four parameters (sample size (n), difference to detect (d), significance level, or power) and the fourth (initially set to NULL) is calculated. The example shown below computes power. Type is the type of analysis you want to do (here, a choice of one-sample or paired)

>power.t.test(n=20,d=5,sig.level=0.05,power=NULL,
type=“one.sample”,sd=5)

Sign Test

There is no dedicated routine for calculating the sign test in R.

Power (Two-Sample )

Replace “one.sample” with “two.sample” in the power command given above.