# Significance Scripts

These statistical significance scripts calculate the t-test statistic for a two-sample difference of means test and shade the grid cells that are significant at a chosen level. There are two different forms of the test: one in which we assume the population variances are equal, and one in we assume the population variances are unequal. You can determine which form of the test to use by conducting a F-test that compares the variances of the two samples. Step-by-step instructions for running the scripts are listed below.

The graphic below shows the results of a t-test for for DJF for FOAM GCM data, comparing model-predicted surface temperatures from 6K B.P. to current surface temperatures. The areas that are shaded gray are signficant at the 99% level.

## Assume Population Variances are Equal

- Calculate your degrees of freedom:
**df = n1 + n2 -2**, where n1 is the size of the first sample and n2 is the size of the second sample. - Decide on the significance level: .01 (99%), .05 (95%), .10 (90%)
- EXAMPLE: say we have two samples of sizes n1=120 and n2=120. The degrees of freedom =
**n1+n2-2 = 120+120-2 = 238** - Say we choose a significance level of
**0.01**. When we enter this information in the appropriate boxes, we find that our**cutoff t is 2.597**. - Now, we move on to GrADS. The script to use is ttest.equal_variances.gs. Put in open statements for your data files (e.g.,
`sdfopen /grove4/selin/foam_indyr/ha.F1.0k.djfi486605.TS1.nc`

) - Set
**n1**and**n2**to the size of the respective samples - In the formulas for
**x1, x2, s1, and s2**, you must set the time increment for each of the formulas according to the sample size. For example,`if n1 is 120, then set x1 = ave(ts1.1,t=1,t=120)`

- Set the contour interval equal to the cutoff t you determined from the web page:
**set clevs 2.597** - Now, run the script. Enter GrADS, and type
`exec ttest.equal_variances.gs`

. The areas that are significant will be shaded gray and the difference between the two means will be contoured.

## Assume Population Variances Are Unequal

- Calculate your degrees of freedom. In this case,
**df = min (n1-1, n2-1)**, where n1 is the size of the first sample and n2 is the size of the second sample. - Decide on the significance level: .01 (99%), .05 (95%), .10 (90%)
- EXAMPLE: say we have two samples of sizes
**n1=120 and n2=10**. Then**degrees of freedom = min (n1-1, n2-1) = min (120-1, 10-1) = min(119, 9) = 9**. This is a conservative estimate of the degrees of freedom. Say we choose a significance level of**0.05.**cutoff t is**2.262.** - Now, we move on to GrADS. The script to use is ttest.unequal_variances.gs. Put in open statements for your data files. In this example, we used the xdfopen option to open our data files because the time indices do not match. Here are the xdfopen files used in this script: xdf6kFixdjf and xdf0kdjf.
- Set
**n1**and**n2**to the size of the respective samples - In the formulas for
**x1, x2, s1, and s2**, you must set the time increment for each of the formulas according to the sample size. For example, if**n1**is**10**, then set**x1 = ave(ts1.1,t=1,t=10)**. - Set the contour interval equal to the cutoff t you determined from the web page:
**set clevs 2.262** - Now, run the script. Enter GrADS, and type
`exec ttest.equal_variances.gs`

. The areas that are significant will be shaded gray and the difference bewteen the two means will be contoured on top.