economics

How to find balanced panel data in R (aka, how to find which entries in panel are complete over given window)

梦想的初衷 提交于 2019-12-22 23:48:15
问题 I have a big panel of data from Compustat. To it I am adding some hand-collected data (seriously hand-collected from a stack of old books). But I don't want to hand-collect for the entire panel, only a randomly selected subset. To find the larger set (from which I'm randomly selecting) I would like to start with the balanced panel from Compustat. I see the plm library for working with unbalanced panels, but I would like to keep it balanced. Is there a clean way to do this short of searching

Supply Demand Modeling

筅森魡賤 提交于 2019-12-21 06:18:00
问题 I thought I would ask the SO community on helping me with a project that I am currently working on. I need to model the price for a widget in a market situation. The price for the widget should be a result from the current supply and demand. Users will be able to buy and sell the widget at the fixed price. As users buy the widget the demand will go up along with the price. Conversely as users sell the widget the supply will go up and the price will go down. The quantity and current price of

Sub setting panel data

孤人 提交于 2019-12-20 04:12:06
问题 Very new, so let me know if this is asking too much. I am trying to sub set panel data, in R, into two different categories; one that has complete information for variables and one that has incomplete information for variables. My data looks like this: Person Year Income Age Sex 1 2003 1500 15 1 1 2004 1700 16 1 1 2005 2000 17 1 2 2003 1400 25 0 2 2004 1900 26 0 2 2005 2000 27 0 What I need to do is go through each column ( not columns 1 and 2 ) and if the data is full for the variable (

Fixed Effects plm package R - multiple observations per year/id

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 03:16:05
问题 I'm working on a state and year fixed effects regression, which has 3 observations per state/year combo based on the race for that row (white, black, other) - See link below. So far, I've been using the base lm function to estimate a fixed effects regression that accounts for all three races. I do this by using state, year and race all as factor variables. I am also running separate regressions for each individual race. The problem is that I would prefer to use the plm package so that i can

How to create doubled a loop?

主宰稳场 提交于 2019-12-12 04:24:14
问题 The following code works out quite well, BUT: I have to change the sample size n = 25, 50, ... and the variance estimator everytime before I run the code. I would like to solve this problem with a loop. Hereafter, I briefly describe the code. Within the code, 1000 regression models for a given sample size n are created. Then, each regression model out of the 1000 is estimated by OLS. After that, I calculate t statistics based on the different beta values of x3 out of the 1000 samples. The

Python - Gini coefficient calculation using Numpy

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 02:18:25
问题 I'm a newbie, first of all, just started learning Python and I'm trying to write some code to calculate the Gini index for a fake country. I've came up with the following: GDP = (653200000000) A = (0.49 * GDP) / 100 # Poorest 10% B = (0.59 * GDP) / 100 C = (0.69 * GDP) / 100 D = (0.79 * GDP) / 100 E = (1.89 * GDP) / 100 F = (2.55 * GDP) / 100 G = (5.0 * GDP) / 100 H = (10.0 * GDP) / 100 I = (18.0 * GDP) / 100 J = (60.0 * GDP) / 100 # Richest 10% # Divide into quintiles and total income within

How to plot an histogram in R with several variables?

情到浓时终转凉″ 提交于 2019-12-08 03:58:02
问题 i have to make an histogram in r with the following data: GDP: CONSTANT VALUES (2008=100) **sector** **2003** **2004** **2005** **2006** **2007** Agriculture 532918 543230 532043 562146 585812 Mining 1236807 1258769 1263937 1250930 1235517 Construction 1505948 1598346 1645017 1785796 1874591 Manufacturing 6836256 7098173 7302589 7731867 7844533 Wholesale 8635763 918174 966467 1037362 1070758 i know the rules and steps to make an histogram of a very simple data (with only one variable

How to find balanced panel data in R (aka, how to find which entries in panel are complete over given window)

拟墨画扇 提交于 2019-12-06 07:20:29
I have a big panel of data from Compustat. To it I am adding some hand-collected data (seriously hand-collected from a stack of old books). But I don't want to hand-collect for the entire panel, only a randomly selected subset. To find the larger set (from which I'm randomly selecting) I would like to start with the balanced panel from Compustat. I see the plm library for working with unbalanced panels, but I would like to keep it balanced. Is there a clean way to do this short of searching for and throwing out firms (individuals in panelspeak) that don't run the sample period? Thanks! After a

Oaxaca Decomposition in R [closed]

余生颓废 提交于 2019-12-05 18:49:48
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 months ago . I would like to make a Oaxaca Decomposition in R. It is used in e.g. labor economics to distinguish explained variance versus unexplained variance, I believe. I have not been able to find a suitable solution in R, and I am rather reluctant to create one myself (I would probably

Oaxaca Decomposition in R [closed]

故事扮演 提交于 2019-12-04 03:40:23
I would like to make a Oaxaca Decomposition in R. It is used in e.g. labor economics to distinguish explained variance versus unexplained variance, I believe. I have not been able to find a suitable solution in R, and I am rather reluctant to create one myself (I would probably mess it up). Anyway, the procedure is briefly explained here: http://en.wikipedia.org/wiki/Ronald_Oaxaca Stata is blessed with a rather good package for this, but Stata is not easily available to me. www.stata.com/meeting/5german/SINNING_stata_presentation.pdf Please note: I have also posted a message on R-help but it