Can We do Better than R-squared?

Tom Hopper

If you’re anything like me, you’ve used Excel to plot data, then used the built-in ?add fitted line? feature to overlay a fitted line to show the trend, and displayed the ?goodness of fit,? the r-squared (R2) value, on the chart by checking the provided box in the chart dialog.

The R2 calculated in Excel is often used as a measure of how well a model explains a response variable, so that ?R2 = 0.8? is interpreted as ?80% of the variation in the ‘y’ variable is explained by my model.? I think that the ease with which the R2 value can be calculated and added to a plot is one of the reasons for its popularity.

There’s a hidden trap, though. R2 will increase as you add terms to a model, even if those terms offer no real explanatory power. By…

Ver o post original 1.248 mais palavras

Instalando o LaTeX

Dica do Hyneman, que tem um ótimo site sobre previsão e estatística (inclusive com livro-texto grátis). LaTeX é uma linguagem de marcação que facilita na hora de escrever artigos com fórmulas. Você escreve o texto usando os marcadores e depois um programa “traduz” para o formato de revista tradicional.


Down­load and run the setup pro­gram for Mik­TeX. Choose the “basic” system.

Down­load and run the installer pro­gram for TeXs­tu­dio.

Then run TeXs­tu­dio and start typing.

via Hyndsight – Getting a LaTeX system set up.

How Economists Convert Quarterly Data into Monthly: Cubic Spline Interpolation

Só repassando esse achado que fiz procurando um método de mensalização (dados trimestrais para mensais) aqui na empresa. Usem com cuidado!

Columbia Economics, L.L.C.

(Update: Please note that cubic spline interpolation can only provide estimates of data between known data points. It cannot “create” unknown data. For example, if only annual figures exist for your data set, then annual observations are the only real data. Cubic splining between them to generate monthly estimates is only an approximation technique, and does not provide new actual monthly figures). For this reason, the below method may not be appropriate for all research purposes.)

A common problem economists face with time-series data is getting them into the right time interval. Some data are daily or weekly, while others are in monthly, quarterly or annual intervals. Since most regression models require consistent time intervals, an econometrician’s first job is usually getting data into the same frequency.

In this post I’ll explain how to solve a common problem we’ve run into: how to divide quarterly data into…

Ver o post original 994 mais palavras

Filtro de Hodrick-Prescott no Excel

Um pouco fora da minha área certamente mas estou sempre pronto a apreciar boa programação e facilidade de uso. Se você precisa tirar a tendência de uma série com o filtro HP e quer a facilidade do Excel, ou quer usar em um ambiente de trabalho onde os programas são controlados, fica a dica do site abaixo. Ele explica onde baixar o add-in e como utilizar. Testado e aprovado.

There is a how to use PDF, short, says you give it a range of cells and a number (a constant). The long version: Select a range of cells for your results, type =HP( , select the range of cells containing the data to be filtered, type in a comma, type in the constant, and close the parentheses. But don’t hit ENTER.

Instead, hold down CTRL and SHIFT and then press ENTER. That’s it. Then you can make a graph or whatever, from the results.

Holding down CTRL and SHIFT while you press ENTER is standard Excel stuff. They call it “array formulas” which sounds pretty complicated… but all you have to do is hold down CTRL and SHIFT while pressing ENTER. How complicated is that?

None of that works, though, if you don’t have the Hodrick Prescott filter installed. No problem. Among the search results is a link to Kurt Annen’s HP-Filter Excel Add-In at IDEAS. There are three separate files you can download:

1. an XLA file, an Excel add-in which adds the HP( ) function to the built-in Excel functions.

2. the Visual BASIC source code for the HP( ) function.

3. an example.

For most people the simple thing would be to install the add-in. (The PDF linked above tells how.) For me, the simple thing was to copy the Visual BASIC source code and paste it into a code module. That way I got to look the code over a bit. It looks like a very complicated (arithmetically) version of a “moving average” calculation, or something comparable. That’s a crude description; I didn’t work through all the arithmetic. But the result you get from the HP filter serves the same sort of purpose as the result you get from the moving average calc.

Anyway, after it’s installed one way or the other, it’s as easy to use as =SUM( ) or any other Excel function. I expect to explore it, and to use it.

What number do you use for the constant?… for the “Lambda” as they call it?

Rule of thumb is:

Lambda = 100*(number of periods in a year)^2

There is additional research that suggests using a power of 4 instead of 2. See Ravn and Uhlig (2002). … 1-375.html

via The New Arthurian Economics: De-Trending.

Modelagem baseada em agente: primeiros passos

Aqui o Understanding Society mostra um bom guia para começar a olhar estes modelos baseados em agente que falei na semana passada e coloca algumas dúvidas sobre a viabilidade do projeto. Para ele (e concordo) quando os agentes são homogêneos podemos usar uma abordagem agregada. Mas quando é que algo é homogêneo? Me parece possível encaixar preceitos evolucionistas nessa abordagem.

Agent-based modeling is an intriguing new set of tools for computational social science. The techniques permit us to project forward the system-level effects of a set of assumptions about agent behavior and a given environment. What kinds of real social phenomena are amenable to treatment by the techniques of agent-based modeling? David O’Sullivan and his co-authors offer an assessment of this question in their contribution to a valuable recent handbook, Heppenstall et al, Agent-Based Models of Geographical Systems. (Andrew Crooks and Alison Heppenstall provide a valuable and clear introduction to ABM methodology in their contribution to the volume.)

via UnderstandingSociety: Domain of agent-based modeling methods.