Interactive Simulations
This page allows you to conduct interactive simulations that allow you to clarify the nature of sampling error in RETs, evaluate Type I and Type II errors, and explore statistical dynamics interactively. YOU DO NOT NEED TO KNOW R TO USE THESE PROGRAMS. Click on a program for a description of it in the 'Description' box. Then go to the 'Input Values' box, enter the requested information, and click 'Register Input.' Your R syntax will be auto-generated in the 'R Syntax' box. Copy and paste the syntax into R on your computer (click 'Install R and libraries' on the program tab for how to install R). The syntax will generate meaningful output, even if you do not know what the syntax says. Watch the video below to see what I mean.
Interfaces with SPSS, Excel, Ascii, SAS and STATA Formats
Statistical Programs
Statistical Primers
Program Evaluation and Randomized Explanatory Trials
After you copy the R syntax to the clipboard, click your cursor in position where you want to paste it (preferably on your version of R or in the 'Run Syntax' box), then press Ctrl-v to paste it. You need not understand the syntax; just execute it.


The web server has a time limit. If it times out, you will need to run the syntax using your own version of R on your computer.  If you set the number of replicates to 2,000, it likely will run on the server; the results won't be as accurate - but in the ballpark.

If for any reason the program will not run on the web server, run it on the R version on your computer.
You can paste the auto-generated syntax into the 'Run Syntax' box to access R on the web. Click the green 'Run' button to execute it. Using R
on the web server has a time limit. If the program times out, use R on your computer instead (go to the 'Program' tab to learn how to install R and the required libraries).
For a guide to using the interactive simulation programs, click here to open a pdf.  To see a video of an example, click here (40 minutes long - but worth it).
Description
R Syntax
Run Syntax
  

For a given simulation, I create a population of a million cases that has the population values you specify in the Input box.

I then randomly select a sample of the size you designate and conduct an analysis on that sample data (e.g., compute a correlation, test mean differences).

I repeat this process 10,000 times, as if 10,000 scientists were replicating the study, each one getting slightly different results because of sampling error (e.g., a different sample of people being selected into the sample).

I show results of 25 of these replications so you see how results vary from one replication to the next. Your study could be any one of these studies or the 10,000 replications. I do NOT use a random seed, so you will see a different 25 samples each time.

I then summarize results across all 10,000 replications.
After you copy
(To clear syntax in  window below. click inside  window, press Ctrl-a to 'select all', and then press space bar.)