Montag, 31. Oktober 2011

Thanks René for pointing this out

Dilbert on economics

I would like to include the funny picture itself here, but then again even though Dilbert is so funny his lawyers are probably not...isn't copyright a nice thing?...
Which brings me to think about Apple's recently granted patent on gestures to unlock a phone

What is next? patenting the movement of soccer players? any amateur player that tries to imitate a trick from a pro has to pay him royalty fees?
What an absurd world those patent-granting-people live in..

Remove the last word in Stata

You have a dataset that you want to aggregate over several levels in a loop. At every loop you want to drop the last group.
The regexm command can drop the last word of a macro in every loop:

regexm("`agglevel'", "([a-z A-Z]+)[ ]([a-zA-Z]+)")

an nice and short introduction for regexm can be found here.

That is the code snippet I use:

(works in STATA11)

foreach var of varlist saledate mofd wofd year{

local agglevel total company store category supplier pricelevel
local facts (sum) items pricesold pricein pricelabel
local words=wordcount("`agglevel'")

forvalues v=1/`words'{
local agglevel_file=subinstr("`agglevel'"," ","_",.)
di "`facts' ,by(`agglevel' `var')"
qui collapse `facts' ,by(`agglevel' `var')
qui my_popagg
qui add_mofd
save `sample'_agg_`agglevel_file',replace
qui gen x=""
di regexm("`agglevel'", "([a-z A-Z]+)[ ]([a-zA-Z]+)")
*will produce an error on the last level -ignore safely
cap local agglevel=regexs(1)
local agglevel="`agglevel'"

Starting a random walk down econometrics...

"Determining whether a particular time series realization is the outcome of a I(1) versus an I(0) process can be quite difficult.".
Dear Mr. Wooldridge, please test me:  I think  as an economist I am a random walk.

What ever caught my attention an hour ago, is most likely to occupy me for the rest of the day. And while my thesis still longs for the day that it will be completed, there is a point in publishing some findings along the route.

There are Stata and R snippets that are nice and the result of hours or days of work; There is literature I found quite useful that I would like to recommend.

 There are people like Arne Henningsen how helped me out that deserve recognition.

And maybe, maybe writting will after all help me finish my thesis as I will publish it piece by piece here. And maybe, only maybe someone interested will come along and leave a comment. Wouldn't that be great?