Thursday, January 27, 2011

Example: Data Distributions

Given the following data:

240 240 240 240 240 240 240 240 255 255
265 280 280 290 300 305 325 330 340 265

Below is a graphical representation of the distribution for this data. The actual graph is referred to as a histogram, and the green curve is a kernel density estimate, which is an estimation of the probability density function for this data. 

The R code used to generate this graph, and to calculate the mean is below:

salary <- c(240, 240, 240, 240, 240, 240, 240, 240, 255, 255, 265, 280, 280, 290, 300, 305, 325, 330, 340, 265)
mean(salary) # calculate the mean
hs <- hist(salary) # plot the distribution - histogram and store
                   # the data about the distribution as the variable hs
d <- density(salary) # calculate the density function for salary
rs <- max(hs$counts)/max(d$y) # resclale the density function so that it can be graphed on the same plot
lines(d$x, d$y*rs, type ="l", col = 51)  # graph the density function for salary
Created by Pretty R at

Tuesday, January 25, 2011

Data Distributions: The Gaussian Copula & Fat Tails

For a  basic explanation of mortgage backed securities &  toxic assets as they relate to the credit crisis see:

The Credit Crisis Visualized Part 1

The Credit Crisis Visualized Part 2

 From: In defense of the Gaussian copula, The Economist

"The Gaussian copula provided a convenient way to describe a relationship that held under particular conditions. But it was fed data that reflected a period when housing prices were not correlated to the extent that they turned out to be when the housing bubble popped."

Decisions about risk, leverage, and asset prices would very likely become more correlated in an environment of centrally planned interest rates than under 'normal' conditions.

See also: Models and Agents-Hit by a Fat Tail

"Economists talk about fat tails when they want to refer to the probability that extreme events such as the above occur in a much higher frequency than you would regard as "normal."

"So why tails? And why fat?!"
read more to find out.

Some examples of data generated from various copula functions and assumptions (using R) :

Tuesday, January 18, 2011

Energy Prices and Natural Resouorces

An application directly from Greg Mankiw's principles of economcis textbook applied to energy prices:

"In a market economy, scarcity is reflected in market prices. If the world were running out of natural resources, then the prices of those resources would be rising over time. But in fact, the opposite is more often true. Natural resource prices exhibit substantial short run fluctuations, but over long spans of time, prices of most natural resources (adjusted for overall inflation) are stable or falling. It appears that our ability to conserve these resources is growing more rapidly than their supplies are dwindling."Greg Mankiw, Brief Principles of Macroeconomics, 5th Ed Ch. 7 p. 144

There Will Be Fuel: NYT

"The same high prices that inspired dire fear in the first place helped to resolve them. High oil and gas prices produced a wave of investment and drilling, and technological innovation has unlocked oceans of new resources. Oil and gas from ocean bottoms, the Arctic and shale rock fields are quickly replacing tired fields in places like Mexico, Alaska and the North Sea...."The technology producing these resources has absolutely made the difference," Mr. Odum said. "It's the same with the Arctic, with the shale oil, all over the world. Technology is the key...."When you add it up," Mr. Morse noted, "you get something that very closely approximates energy independence."

Economic Optimism: NYT

"It's true that the real price of oil is slightly higher now than it was in 2005, and it's always possible that oil prices will spike again in the future. But the overall energy situation today looks a lot like a Cornucopian feast, as my colleagues Matt Wald and Cliff Krauss have recently reported. Giant new oil fields have been discovered off the coasts of Africa and Brazil. The new oil sandsprojects in Canada now supply more oil to the United States than Saudi Arabia does. Oil production in the United States increased last year, and the Department of Energy projects further increases over the next two decades.........You can always make news with doomsday predictions, but you can usually make money betting against them. "

The Energy Future Ain't What it Used to Be: NYT

"The price of natural gas and electricity will be low over the next quarter-century, and crude oil will become more expensive but not radically so, the Energy Department predicted on Thursday, in a report that contradicts widely held notions. And even without a national global warming law, American carbon dioxide emissions will not inexorably set new records; they will stay below the rate of 2005 for the next 15 years because of economic forces, the forecast said. "

Data Science

Venn Diagram by Drew Conway
Below is a great article on the rise of data science. It is very tellinf of the current climate and opportunities that are possible given skills in statistics, applied economics, and knowledge of computer science and IT.

Article: 'The Rise of Data Science' .
"Data scientists don't have to be hard-core computer geeks, says Conway, but they do have to know their way around the IT landscape because that's where the data lives. Hacking abilities are important because data tends to reside in multiple locations, and in multiple systems. Finding and retrieving data sometimes requires the skills of a burglar -- even when the data is in the public domain, owned by your organization, or owned by another organization that has agreed to let you use it."
"The trend is toward a multi-disciplinary approach to extracting value from data. It's not just about math anymore. You also need technology skills, but what ultimately separates the analyst from the scientist is the dimension of artistic creativity. It's the soft skills that make the big difference."
The Venn diagram "is useful, but I don't think that one person can do all of this," says Elashoff. An interdisciplinary team, however, could possess the skills depicted in the diagram. "It's pretty hard to be an expert in all these areas."