Data Preparation

Loops in Stata: Making coding easy

October 21st, 2014 by

We’ve already discussed using macros in Stata to simplify and shorten code.

Another great tool in your coding tool belt is loops. Loops allow you to run the same command for several variables at one time without having to write separate code for each variable.

This discussion could go on for pages and pages because there is much you can do with a loop. (more…)


R Is Not So Hard! A Tutorial, Part 18: Re-Coding Values

August 29th, 2014 by


One data manipulation task that you need to do in pretty much any data analysis is recode data.  It’s almost never the case that the data are set up exactly the way you need them for your analysis.

In R, you can re-code an entire vector or array at once. To illustrate, let’s set up a vector that has missing values.

A <- c(3, 2, NA, 5, 3, 7, NA, NA, 5, 2, 6)

A

[1] 3 2 NA 5 3 7 NA NA 5 2 6

We can re-code all missing values by another number (such as zero) as follows: (more…)


R Is Not So Hard! A Tutorial, Part 9: Sub-setting

December 2nd, 2013 by

In Part 9, let’s look at sub-setting in R. I want to show you two approaches.

Let’s provide summary tables on the following data set of tourists from different nations, their gender and numbers of children. Copy and paste the following array into R. (more…)


R Is Not So Hard! A Tutorial, Part 8: Basic Commands

November 24th, 2013 by

Let’s look at some basic commands in R.

Set up the following vector by cutting and pasting from this document:

a <- c(3,-7,-3,-9,3,-1,2,-12, -14)
b <- c(3,7,-5, 1, 5,-6,-9,16, -8)
d <- c(1,2,3,4,5,6,7,8,9)

Now figure out what each of the following commands do. You should not need me to explain each command, but I will explain a few. (more…)


On Data Integrity and Cleaning

July 30th, 2010 by

This year I hired a Quickbooks consultant to bring my bookkeeping up from the stone age.  (I had been using Excel).

She had asked for some documents with detailed data, and I tried to send her something else as a shortcut.  I thought it was detailed enough. It wasn’t, so she just fudged it. The bottom line was all correct, but the data that put it together was all wrong.

I hit the roof.Internally, only—I realized it was my own fault for not giving her the info she needed.  She did a fabulous job.

But I could not leave the data fudged, even if it all added up to the right amount, and already reconciled. I had to go in and spend hours fixing it. Truthfully, I was a bit of a compulsive nut about it.

And then I had to ask myself why I was so uptight—if accountants think the details aren’t important, why do I? Statisticians are all about approximations and accountants are exact, right?

As it turns out, not so much.

But I realized I’ve had 20 years of training about the importance of data integrity. Sure, the results might be inexact, the analysis, the estimates, the conclusions. But not the data. The data must be clean.

Sparkling, if possible.

In research, it’s okay if the bottom line is an approximation.  Because we’re never really measuring the whole population.  And we can’t always measure precisely what we want to measure.  But in the long run, it all averages out.

But only if the measurements we do have are as accurate as they possibly can be.

 


Great Resources for Your Literature Review

April 30th, 2010 by

by Ursula Saqui, Ph.D.

This is the second post of a two-part series on the overall process of doing a literature review.  Part one discussed the benefits of doing a literature review, how to get started, and knowing when to stop.

You have made a commitment to do a literature review, have the purpose defined, and are ready to get started.

Where do you find your resources?

If you are not in academia, have access to a top-notch library, or receive the industry publications of interest, you may need to get creative if you do not want to pay for each article. (In a pinch, I have paid up to $36 for an article, which can add up if you are conducting a comprehensive literature review!)

Here is where the internet and other community resources can be your best friends.

  • Know the difference between Google and Google Scholar. Google is helpful for popular mainstream publications whereas Google Scholar focuses only on scholarly references such as articles, theses, books, abstracts, and court opinions that are written by academics and other professional scholars.
  • ResearchGATE is an example of a collaborative scientific community that indexes articles. Many times you can find the full text of articles at no charge.
  • Your state may offer access to different databases for its residents. For example, in my home state of Indiana, residents have access to Inspire, a collection of resources, databases, and government publications. Click here to see if your state offers a similar resource.
  • Check your local community library. They may not have the resources you need but they can often get them through inter-library loan. For example, my local community library does not carry advanced statistics books but the librarians can get them for me via their borrowing privileges with universities.
  • Even without access to a specific database, you can search thousands of government sponsored research reports that have been conducted by the U.S. government or one of its affiliates. For example, in completing a literature review of service learning programs, I found a government report that summarized 10 years of research in service learning. (That made my day!)
  • Private foundations or research companies may also conduct high-quality peer-reviewed research. For example, the Robert Wood Johnson Foundation conducts and disseminates research on issues related to health and health care.
  • If you know who authored the article, you can sometimes find a pdf file of their article on their website or university website listed under their vita or recent publications.
  • Try to contact the author directly. When I have contacted authors, they have graciously sent me a complimentary copy of their article.

Still stuck?  Hire someone who knows how to do a good literature review and has access to quality resources.

On a budget?  Hire a student who has access to an academic library.  Many times students can get credit for working on research and business projects through internships or experiential learning programs. This situation is a win-win.  You get the information you need and the student gets academic credit along with exposure to new ideas and topics.

About the Author: With expertise in human behavior and research, Ursula Saqui, Ph.D. gives clarity and direction to her clients’ projects, which inevitably lead to better results and strategies. She is the founder of Saqui Research.