Topic outline

  • The course has computer assignments during which you will work on data analysis problems using a statistical software. The purpose of these assignments is to familiarize you to statistical software, teach you how to interpret analysis results, and teach some basic principles of reproducible research.

    Each submission consists of two parts:

    1. Analysis file (Stata do file, R file, or SPSS syntax file)
    2. A report based on the analysis file

    You need to upload two files into separate tabs in the TurnItIn activity. Uploading zip files is not allowed because the file contained in compressed packages cannot be commented online.

    Analysis file

    You may use the statistical software by using menus or typing commands, but at the end you need to go through your analysis log and record the commands that you did to an analysis file that will reproduce all the relevant analyses. Using analysis file is important for reproducibility of research. This is important for two reasons

    1. Other researchers may be interested in the details of your data and analysis, and an analysis file completely documents all your analyses.
    2. If you submit an article to an academic journal, the reviewers often suggest changes to the analyses. Maintaining an analysis file will make these changes much easier to implement.

    To verify that your analysis file works, it is recommend that you restart or otherwise completely reset the statistical software before running the final version of the analysis file. The file produces an analysis log, which will form a basis of your report.

    Report

    The analysis file is then converted to a report, which documents what exactly you did, why, and how you interpreted the results.

    The work flow for producing a report is demonstrated in the screencast for the first data analysis assignment and consists of the following three steps:

    1. Prepare and run one analysis file that contains all analyses that you did.
    2. Export the analysis log as a Word document
    3. Add headings and normal style paragraphs where you explain your interpretation of the analyses to the Word document.

    The purpose of the comments that you write is to document your thought process: how did you explore the data, how you interpreted the results, how you checked the assumptions, and how the model evolved. Include a conclusions section where you explain what is your answer to the research question based on the analyses and assess the size of the effects.

    Producing a report using Stata

    Start by installing the user written MarkDoc module and its dependencies:

    net install github, from("https://haghish.github.io/github/")
    github install haghish/markdoc, stable
    You need to do the steps listed above only once.

    Add the following line to the beginning of your analysis file:

    log using report, replace

    Then after each graphics command, add the following:

    img

    Add the following line to the end of your analysis file:

    log close
    markdoc report, export(docx) mini replace

    Running the analysis file after these modifications will produce a log file in Word format.

    It is a common problem that in Windows the report does not contain any images. This happens because the MarkDoc package does not work well with network drives. Make sure that your working directory is set to your computer instead of a network drive. The current working directory is show in the bottom left corner of the Stata main window. If the path starts with "//", you are working on a network drive. One way to fix this issue is to run the following code, which will create a temporary directory for you and set that as a working directory:

    tempfile tf
    mkdir "`tf"
    cd "`tf"'

    Producing a report using RStudio

    After preparing the analysis file, use the Compile notebook feature to compile an MS Word type document. 

    Producing a report using SPSS

    After preparing the analysis file, first close all output windows. Then select the full analysis file (ctlr+a / cmd+a) and run the file. In the new output window that appears, click on the Export button and export the log in "Word/RTF" format.

    Screencasts

    The screencasts for the first assignment, available here, demonstrate the process of creating a report using R, SPSS, and Stata.