Economics should be open

July 29, 2009

Stata, control flow based on variable type

Filed under: Uncategorized — howardchong @ 12:45 am

Suppose you want to write a function (or a loop), where you do something to every variable that depends on its type. In matlab, I would use “isnumber”, etc, or just use the function that returns the type of the variable.

I couldn’t find such a function in stata. There is no “isnumeric” or “isfloat” function.

There is an extended function called “type”. This is my prefered way to do it:

local mytype : type myvarname
disp "`mytype'"

They also have “confirm”, which works:

http://www.stata.com/help.cgi?confirm

(more…)

Advertisements

July 28, 2009

octave error “error: invalid call to script”

Filed under: Uncategorized — howardchong @ 11:18 pm

I am new to Octave. I am using Octave 3.0 on windows (with octave-forge) and trying to call a script and get the following error:

“error: invalid call to script”

The fix?

I was trying to run hello1.m by typing

hello1.m

but I need to take the .m off and type

hello1

This error may also come up for different reasons, but this was my reason.

July 27, 2009

Input Output Table, generating from BEA data

Filed under: Uncategorized — howardchong @ 6:52 pm

I struggled a bit in putting together an input output  table (IO table) for the US economy in doing my research on the impact of carbon prices on industrial activity.

Here I include Octave (compatible with MATLAB) code to generate an input output table given 3 inputs from the Bureau of Economic Analysis:

  1. Total consumption
  2. Industrial activity linked to commodity (USE)
  3. Industries and how much of each commodity they produce (MAKE)

More…

(more…)

July 20, 2009

identity matrix in excel

Filed under: Uncategorized — howardchong @ 10:13 pm

So, excel can do matrix calculations. That’s useful. But why the hell didn’t it give us a function to create an identity matrix.

Here’s a quick hack (no programming) to generate an identity matrix.

(more…)

June 4, 2009

Billing Data and Randomized Experiments in Energy Efficiency Evaluation a research survey

Filed under: California, Data Insights, Energy, Residential — howardchong @ 9:44 pm

I’m doing a research survey of empirical evaluations of energy efficiency using billing data. Much evaluation is done in the laboratory and these estimates are extrapolated to the field. I’m looking at whether field data has been used to test the laboratory assumptions. I found one by Dubin et al from 1986. I review why this is important and other related articles. This is part of my ongoing research so feedback, especially detailed and esoteric knowledge are greatly appreciated.

(more…)

May 21, 2009

Heavy variation in heating fuel — implications for electricity use analysis

Filed under: Uncategorized — howardchong @ 6:55 pm

As researchers, we try hard to be rigorous, but one of the biases we are most susceptible to is that our local world is representative of and similar to the rest of the world. This is untrue, except given homogeneity. If there is any variation, then at least somebody is “abnormal”.

Hence, I was surprised to learn that CA is not normal in terms of heating fuel use and that this non-normality is pretty significant. CA is extremely natural gas intensive, with the most credible reports (consider CA RASS 2004) saying that ~70-90% of homes heated by natural gas. Using a national data set, we can see the variation. In 1997 (RECS), 68% of households in CA used natural gas heating. Oregon and Washington, cooler climates with more heating load, had 20% of households using natural gas, and 62% heating with electricity. Part of this may be due to  the lower prices for electricity in the Pacific Northwest.

What does this mean? It means that I shouldn’t be comparing CA to OR and WA because it’s an apples to oranges comparison. I also shouldn’t be doing difference in difference analyses because whatever treatment we can think of will be polluted by these other state-specific factors.

(more…)

May 19, 2009

CO2 emissions of transit, redux

Filed under: Uncategorized — howardchong @ 8:57 pm

I had always thought that driving was way worse for the environment than taking mass transit. Just think of it; I’m lugging around 2 tons of metal to move me from one place to another. A motorcycle is much better, but a car is so dang convenient. And the road network is perfectly designed to work best with cars.

 

But out comes some studies with contradictory evidence that says that transit may actually be worse for the environment. The key here, is that a bus gets about 5-7 mpg; so you need about 6 people riding on average (for the whole line, not just the middle) to equal each person driving separately by car. Where this is true, it’s very carbon efficient. Where it is not, well, that may be what’s happening in Cleveland, OH.

 

(more…)

April 3, 2009

Why Chinese Electric Cars are different

Filed under: China, Data Insights, Energy — howardchong @ 7:10 am

NYTimes just reported that China’s going gangbusters on electric car development:

http://www.nytimes.com/2009/04/02/business/global/02electric.html?em

Are they going to win with stolen foreign patents? Or putting up trade barriers? Or just win with their extremely cheap labor.

Nope. That may be some of it, but one big issue is the price of electricity. Electricity is cheap in China. (more…)

April 2, 2009

Why a big hedge fund WON’T pursue the Geithner Plan

Filed under: bank bailout — howardchong @ 8:22 pm

This article explains why a alarge hedge fund manager doesn’t like the PPIP. Political risk, and more details about the execution make it look even more fishy. There are supposed to be only 5 fund managers that manage these funds.

 

More here:

http://www.businessinsider.com/henry-blodget-ray-dalio-why-bridgewater-wont-be-playing-tim-geithners-ppip-2009-4

Geithner plan arithmetic, excel worksheet, bundling all assets together

Filed under: Uncategorized — howardchong @ 1:58 am

So, Stiglitz and Krugman have come out against the Geithner Plan, as have I.

 

As a quick exercise, I made an excel worksheet that values a toxic asset under the Geithner plan and under risk neutrality.

You can find it here:  http://are.berkeley.edu/~chong/filesforblog/Geithner%20Arithmetic.xls

If you play around with the percentages, you’ll note, as Krugman has in the NYTimes, that the government is effectively giving investors a free put option.

I’m assuming a 7-to-1 leverage ratio and a 50-50 match.

Do note that this makes clear how the price gets inflated and where the government eats the loss (when the asset price falls more than 12.5%).

However, it completely assumes that the market doesn’t have a good sense of what percentages to put in for the probilities of value for the asset. The holders argue they won’t sell because nobody will buy given the probabilities they believe to be true. The buyers argue that the market is really risky and that these probabilities are too high. It’s like when I go to buy a used car. I always look at the faults and try to say, all these things will probably break in a year. And the seller says, “This is a great car.” If it’s so great, the seller should keep it and hold it to maturity!

One thing that the Geithner plan does get right is that they mandate that the buyers must put these assets in a buy-and-hold strategy.

One thing Geithner may not have considered is how to bundle the assets. He needs to bundle as many assets together as possible!

For example, if the asset is a single mortgage, the probabilities will be nonzero only for  $100 (if they pay it) and $0 (if they default). But if you bundle 1000 of these, you start getting probabilities that aren’t so extreme. (you’d have a binomial distribution distribution). Whether you are buying a block of 1000 or a single mortgage doesn’t matter normally, but the Geithner plan has a non-recourse loan that is  MUCH more valuable if you buy each one separately.

It could be argued that the government exposure is actually going to be quite small if they bundle assets together enough. There is the problem that there is too much correlation across assets so bundling might not work. In that case, the government might want to throw some negatively correlated assets in with the sale.

There’s still the cheating issue, though. See https://opensourceeconomics.wordpress.com/2009/03/25/how-to-scam-the-geithner-plan/

« Newer PostsOlder Posts »

Blog at WordPress.com.