**Click Primer button to easily learn & generate APL symbols. **

Hover your cursor over any symbol for a description.

Click on any symbol to copy it to the input line.

- Intro
- Input
- Central Tendency
- Dispersion
- Confid Interval
- Sample Size
- Confid & t-test
- Paired t-test
- Regression
- Plot
- Work
- Ref Card
- Primer Help

**Taming Statistics: Learn & Do with Examples: by Stephen M Mansour & Jerry M Brennan.**

Download any PDF listed below & then try examples below.

(A split screen with 2 windows might be helpful. Put PDF window on 1 side & this window on other side.)

(Then you can drag examples from PDF into **Input:** box below, and click **Calc** button.)APL Lessons and Examples: PDF by Jerry M Brennan 67 pages (revised 4/19/2017) Statistical Calculations by Stephen M. Mansour(pdf) (revised 1/1/2015) Reference Card by Stephen M. Mansour(pdf) (revised 9/13/2016) Inferential Statistics by Stephen M. Mansour(pdf) (revised Jan 20, 2015) Taming Statistics Users Guide by Stephen M. Mansour(pdf) (revised 7/19/2016) Click Here for: Users Guide SampleData.csv & choose where to save it on YOUR computer). Now Import **SampleData.csv** variables into APL. Press **Choose File** below & then Press **Import to Namespace D**

Now type/drag **D.Student** or **D.Sex** or.. to **Input:** box & Press **Calc** to see data.

```
```**You can input data in 3 different ways.**

**1. Data dragged or copied & pasted**(i.e. from PDF examples) into the **Input:** box below.

1b. Example: Drag or copy & paste **+/1 3 4** to **Input:** box below & Press **Calc**

1c. Example: Click any **purple** text **+/2 4 6 7** to copy it to **Input:** box below & Press **Calc**

**2. Data from file:** use **Choose File** button below. File can use either commas or spaces between values.

2a. First row must contain variable names and following rows each contain 1 value for each of the named variables.

2b. Variable names must begin with letter & contain only upper & lower case letters and/or digits 0-9. Spaces in names not allowed.

2c. Data can be numeric or any characters(except commas). Character Spaces ok if comma separators.

2d. Example: row 1 names: **Name,Age** rows 2&3 data:**Jim Ito,12** and **Jo Til,22**

2e. Data is stored in namespace: **D** so use full name to access it: **D.Name** or **D.Age**

**3. Data entered by you** into **Input:** box below.

3a. Begin with valid variable name(letter first & contain only upper & lower case and/or digits 0-9).

3b. Variable name then assignment **←**

then data with spaces between #'s or chars with single quotes around each char data.

3c. To get the assignment arrow ** ← **

to **Input:** box drag it or click **Primer** button then the arrow symbol **←**.

3d. Examples: Numeric: **AGE←15 13 11** Character: **SexOfChild←'Male' 'Unknown' 'Female'**

3e. Click on each of above in **purple** to copy to **Input:** box & press **Calc** on each.

3f. Now Click each of these: **AGE** and **SexOfChild** to send to **Input:** box & press **Calc** on each.

3g. Now Click each of these: **↑AGE SexOfChild** and **⍉↑AGE SexOfChild** to send to **Input:** box & press **Calc** on each.
**Central Tendency:(for ordered numeric data only)**

Four common measures of central tendency are: **mean median mode proportion**

Let's create some random data and evaluate it.

Click **DATA←?25⍴9** & press **Calc** button below Input:

Now click **DATA** & press **Calc** to see 25 random #'s from 1-9.

Now click each then press Calc for each of the following: 1) **mean DATA** 2) **median DATA** 3)**mode DATA**

Now create proportion data click: **PRO←¯1+?35⍴2** & view it **PRO** & find it's central tendency **proportion PRO**
**Common measures of Dispersion:**

**range min max variance standardDeviation quartile skewness kurtosis frequency**

All work on ordered numeric data. **frequency** also works on character & categorical numeric data.

Try each on your data or from SampleData.csv(if variables listed below or **Choose File** to reimport them).

For imported data from SampleData.csv remember to include Namespace D. Click: **frequency D.Eyes**

For a labeled barchart click follwing to Input window and click Calc: **FreqBar ⍉frequency D.Eyes**
**Confidence Interval:**

If you took a # of samples from data pool & calculated means for each they would all be somewhat different. Each sample mean would be an estimate of the population mean. Most would be close to the population mean but some might differ quite a bit. If you took larger samples the sample means would tend to be closer to the population mean with fewer outlier means. Most would be either a little less or a little more with fewer extremely more or extremely less. Statistically this would tend towards a bell shaped curve. Statistics can thus be applied to compute a confidence interval. We can't be sure our sample is a perfect estimate, but we can determine a confidence interval around our sample mean using sample size & variability. A 95% confidence interval is often used(i.e. we're 95% certain the population mean is in the confidence interval around our sample mean.

**Example 1**: You sample 100 students & 55 say they will vote for Mary. Can you be 95% certain she'll win(get >50% of votes)? Click purple code below to send code to **Input:** box & click **Calc** to see. Code below first creates the data & then determines confidence interval:

**.95 proportion confidenceInterval YES←55 45/1 0**

Now click it again but modify YES to 60 & no to 40 before pressing the **Calc** to see that the confidence interval.

The confidence interval for 55/45 encompassed values below .50 so we could not be 95% sure, but 60/40 did not. Now play with bigger samples(try 200 ie 120 80 for the 60 40 %) or different confidence intervals such as .99 by making slight modifications of your **Input:** box below.
**Determine Sample Size Needed To Demonstrate Significant Results:**

**If your samples are too small you will not demonstrate significant differences. If samples are too big you will be wasting time/money/your energy. Picking the right sample size if a very very important first step in doing research. **

To determine the sample size you must know the size of the difference you wish to detect and have an estimate of the variability you will encounter in your data. If you wanted to detect a 2 point difference of the mean in your sample data 95% of the time and the standard deviation in your data was 12.

Click purple code to send the following to Input line below: **.95 mean sampleSize 2 12** and press the **Calc** button to find the sample size needed.

To be 99% sure that Mary will get >50% of the vote if in your sample of students 55% or more said they would vote for Mary, how big of sample do you need?

Click and press calc on this to find the sample size needed: **.99 proportion sampleSize .05 .55**
**Hypothesis Testing: Confidence Intervals & t-test**

If average height of people is 68", is that significantly different than **SampleData.csv** data?

Significantly commonly means we want to be 95% certain difference we got is not due to chance.

Since data is a sample of people other samples could be taken & they would have different means.

Let's calculate sample mean & using sample variability the 95% confidence interval of the mean.

Click following purple code to **Input:** box and press **Calc**

**mean D.Height** and **.95 mean confidenceInterval D.Height**

Since the 95% confidence interval does not include 68 we are 95% sure that sample is different.

We can also do .05 significance test: **.05 report D.Height mean hypothesis = 68**

Now to see if male heights differ significantly from females: Click and Calc each** of next 3 lines**

**mean MaleHeight←(D.Sex eq'M')/D.Height**

**mean FemaleHeight←(D.Sex eq 'F')/D.Height**

**.95 mean confidenceInterval¨ FemaleHeight MaleHeight**

No overlap in confidence intervals so 95% sure male & female means are not equal(ne).

Now we can verify with this: **.05 report MaleHeight mean hypothesis ne FemaleHeight****
****Hypot Test:paired t-test**

On previous tab we compared 2 different groups: males and females. In this example we compare same people before and after a treatment. In this case imagine the same students being tested before and after watching a calculus video. Click on each purple text below to copy to Input: then press **Calc to see each result.**

**mean PRE←18 21 16 22 19 24 17 21 23 18 14 16 16 19 18 20 12 22 15 17**

**mean POS←22 25 17 24 16 29 20 23 19 20 15 15 18 26 18 24 18 25 19 16**

**DIFS,mean DIFS←POS-PRE** ⍝ show diffs & mean dif between pre & post scores for each student.

**.05 report DIFS mean hypothesis>0** ⍝ Average difference is significantly > 0 (1tailed t-test ⍺=.05)

**.95 mean confidenceInterval DIFS** ⍝ 95% confidence interval of average diff(2.05) is above 0.**
****Regression:**

click: **report regress D.ShoeSize D.Height D.Student**

Results:B0 intercept significant p=.00002 (but not really important avg ShoeSize is < Height)

Results:B1 significant p=.00000 (Height is useful in predicting ShoeSize)

Results:B2 not significant p=.71269 (Student # is not useful in predicting ShoeSize)

click: **D.ShoeSize RegLinPlot D.Height**
**Plot:**There are 100's of plotting routines. Here are a few you may find useful.

**plotxy** for example plots first variable on x and all rest(1 or more) on y axis:

click: **X←1 2 3 4 ⋄ Y1←4 6 7 8 ⋄ Y2←3 5 9 11 ⋄ plotxy X Y1 Y2**

click: **ch.Set('Head' 'My Plot')('Ycap' 'Y label')('Xcap' 'Xlabel')('Key' 'Y1,Y2') ⋄ plotxy X Y1 Y2**

click: **stemleaf 500+?50⍴120**

click: **boxandwisker 5+?50⍴12**

click: **FreqBar Freq ?500⍴12** or just click: **freq ?500⍴12** to see just frequency table.

click: **QuadPlot 2 ¯1 ¯7** ⍝ for Equation: (2x*2)+(¯1x)+(¯7) and thus:a=2 b=¯1 c=¯7

click: **5 25 .000001 PlotAreaUnderCurve '(X*2)+5'** ⍝ for Y=5+X*2 from X=5 to 25 with 6 decimal accuracy
Click on Primer button to show/hide the APL Primer a floating keypad of APL symbols.

Drag the floating keypad to a convenient place on the screen.

Hover mouse over any APL character to see a pop-up explaining more about the symbol with examples and shortcut to enter it directly from your keyboard.

If you "click" on any APL symbol on Keypad that character will be added to the INPUT field below.

When your INPUT field is completed Click **CALC** button or press your "ENTER KEY" to process your calcuation and see the results.

**
**