Belen Chavez
  • Introduction
  • About
  • Data Blog
  • Calligraphy
  • Teaching

Week 2

1/27/2016

0 Comments

 
We will be using ssa_names.txt in today's lecture and homework assignment. 
This week we will begin learning about panel data and using Stata's xtset.
​
ssa_names.txt
File Size: 32683 kb
File Type: txt
Download File

week2_assignment.do
File Size: 2 kb
File Type: do
Download File

week2_helpfulhints.do
File Size: 1 kb
File Type: do
Download File

week2_lecture.do
File Size: 3 kb
File Type: do
Download File

Week 2 log from lecture
File Size: 62 kb
File Type: txt
Download File


​On reshape: 

Suppose, I have the following dataset (menu.dta) and I want to reshape it so that I have separate price columns for food and drink. 

Let's see what the data looks like. For variable "type",  D = Drink, F = Food.
use menu.dta, clear
ed
Picture
Since I want to reshape prices such that I have separate columns for food and drink, I tell Stata to reshape my data. We want to go from long to wide using the price variable, I want my rows (i in the reshape command) to be the menu items, and my columns (j in the reshape command) to be the drink/food type. Note that the "type" variable is string, so we have to type -string- in our reshape command.

Therefore I type the following into Stata and I see that I have reshaped the data such that I have variables PriceD and PriceF for the drink and food prices of the menu items. Just what we wanted.
reshape wide price, i(menu_item) j(type) string
ed
Picture
Now suppose that I have menu prices over different years and again I want prices to be different columns. We follow practically the same steps as above.
use menu_by_year.dta, clear
ed
Picture
Again we're going from long to wide, but this time we have years in our data. So, we're reshaping our price variables and I want my row variable (i) to be menu items WITH prices. YES, (i) can contain multiple variables, and I want my columns (j) to be the drink/food type. (Again, this is a string variable.)

Therefore I type the following and I see that I have reshaped the menu item such that I have variables PriceD and PriceF for the drink and food prices for the menu items and years. 
reshape wide price, i(menu_item year) j(type) string
Picture
And there you have it. This latter example will be useful in this week's assignment. 
menu.dta
File Size: 0 kb
File Type: dta
Download File

menu_by_year.dta
File Size: 1 kb
File Type: dta
Download File


Line graphs
Just for reference here are some line graphs containing the popularity of your names over time:
Picture
0 Comments

Week 1

1/22/2016

0 Comments

 
Welcome to Econ 641L:

For the first class, make sure you have  the following:
  • Stata 14 MP/SE (Stata 12 or 13 are good too)
  • BitBucket account (create a repository)
  • SourceTree 

​We will be going over the syllabus and reviewing Stata from last semester. The first week's lecture and week 1 assignment are attached below. 
Syllabus.pdf
File Size: 96 kb
File Type: pdf
Download File

Bitbucket_instructions.pdf
File Size: 332 kb
File Type: pdf
Download File

Sourcetree_commit.pdf
File Size: 341 kb
File Type: pdf
Download File

2016-01-20_lecture.do
File Size: 2 kb
File Type: do
Download File

week1_assignment_updated.do
File Size: 2 kb
File Type: do
Download File

0 Comments

    Economics 641L 
    ​Spring 2016

    I will be posting most course material on this page for the Econometrics Lab course at SDSU.

    See Blackboard for assignment submissions.

    Week:

    All
    Week 01
    Week 02
    Week 03
    Week 04
    Week 05
    Week 06
    Week 07
    Week 08
    Week 09
    Week 12

    Monthly Archives:

    April 2016
    March 2016
    February 2016
    January 2016

Powered by Create your own unique website with customizable templates.
  • Introduction
  • About
  • Data Blog
  • Calligraphy
  • Teaching