Wednesday, March 16, 2011

Tutorial: Portfolio Optimization Using R

I wrote a tutorial on how to implement some portfolio optimizers in R for a class. The tutorial implements three types of factor models:



  • A Fama-French three factor model

  • An industry cross-sectional model

  • A principal component analysis model


This is for instructional purposes only: it's not a software for you to plug in your portfolio and start investing. However, if you make millions doing so, I wouldn't mind a 10% cut.


Two things that are not in the tutorial but that are important if you really want to implement something for real use are:



  • Selecting the data that will be used for optimization (I use the Dow Jones Industrial Average from 2006 to 2010)

  • Optimizing Sharpe ratios by combining the portfolio with a risk-free asset (such as T-bills)


Download Factor Models



Monday, March 14, 2011

The Durbin Amendment

I recently had to prepare a paper about the impacts of the Dodd-Frank legislation for a class. Rather randomly, I chose the Durbin Amendment, a provision that increases regulation on the debit card market. What I learned about the debit and credit card market was fascinating.


The amendment passed into law in July 2010 and the Fed is now discussing how it will be regulated, and this is where the relevant points appear. For example, the amendment requires a price cap on the fees that merchants have to pay, but it doesn't say how much. The average fee in 2010 was about 44 cents, and the Fed set the cap at 12 cents, cutting heavily into the profits of (I can safely say)  your bank. As a consequence, you may pay more for checking, but is this really bad?


Download Durbin Amendment



Thursday, March 10, 2011

Managerial economics (B ECON 300) class notes

It is very possible that many of my Managerial Economics students will scour the web for class notes (instead of using the course website). And maybe, just maybe, after spending some time on Wikipedia's article on Managerial Economics and in some random essay mills, they may find the lecture notes here.


It's very possible that looking at the course website would have been faster, but the course website is not integrated with Facebook and not accessible through Google, so I'm just making it easy on them.


Download Managerial Economics Lecture Notes



Wednesday, March 09, 2011

Quantitative Easing Explained

via www.youtube.com



The part about the CPI is priceless.

(sorry about the cheap pun!)



Tuesday, March 08, 2011

xkcd: Advertising



via xkcd.com



Nothing more annoying for a mathematician (of sorts) than the "up to 15% or more"...



The joy of copulas: An R tutorial

I explore copulas by creating a model with four funds that track market indexes
for stocks, bonds, dollar and commodities. I then use the model to generate simulated values
and test the performance of a model portfolio using the real returns and the simulated returns
to calculate the value at risk (VaR) and the expected shortfall (ES).


Download Copulas



Monday, December 15, 2008

Can Windows Live Writer Beta cross-post seamlessly?

I’m now using Windows Live Writer Beta to write my blog entries. This new year will be crazy. Another child, MBA, Ph.D. application, maybe a new job. That’s likely to be too much for the best of us, so anything that saves even a little time helps.

Thursday, November 02, 2006

Windows Live Messenger v8.1 Beta:

 Ah, uma nova versão do meu produto preferido - o Windows Live Messenger. Algumas novidades:

- Seu "nome" e foto aparecem de qualquer computador que você entre.

 

- Contact cards estão mais bonitinhos e aparentemente mais fáceis de usar.

Aparentemente tem mais algumas mudanças "internas" e um bug com o Flash que acontece só no Vista. Estou usando o vista, mas ainda não vi o bug. O fix está abaixo (copiei do blog do Messenger):

------

Vista users please follow the work around below to avoid the "DEP flash crash".

1. Uninstall Flash Player (Click Start->Control Panel->Uninstall a Program, then select Flash Player)

2. Close Windows Live Messenger and any other programs that use Flash

3. Open Adobe public Flash Player beta site

4. Click "Download Installer for Windows Active X" to install

------

Link to Inside Windows Live Messenger:

Thursday, May 25, 2006

Starbucks em São Paulo?

Java Chip Frappuccino... :-)
 

O Michael não morreu

Foi interessante o episódio de ontem. Obviamente deixou mais perguntas abertas do que resolvidas. O Michael não morreu, mas tem pelo menos três personagens que podem ter ido pro beleléu. Curioso foi o pessoal falando em português no final.

Wednesday, May 24, 2006

Anuncio antecipadamente que o Michael morre no episódio de hoje

Sério. É básico de script. Crime e castigo. Quando não dá pra resolver a história de uma maneira boa, os escritores em geral matam o personagem, exceto o Stephen King e o Tolkien . O Stephen King destrói o mundo (com uma combinação aleatória de gripes, alienígenas e Tommyknockers) e o Tolkien apela pra umas águias convenientes. Deus Ex Machina.
 
Não deve ter Deus Ex Machina pro Michael. Então é cova mesmo.

Tuesday, May 23, 2006

PCC libera banho de sol para habitantes de São Paulo

A pedido do governador, que ameaçou se rebelar e fazer uma greve de fome televisionada, o PCC liberou o banho de sol para habitantes da cidade de São Paulo. A razão alegada foi que muitos presos do PCC assistem televisão e acham greve de fome de governador muito chata. Preferem Big Brother.

Usando o Moleskine como carteira

Até agora, bem legal.

Monday, May 22, 2006

As a good neighbor, State Farm is there... doing nothing!

Primeiro de tudo devo dizer que não foi tão ruim assim. Podia ser bem pior.

Ontem o carro da Ilanah quebrou na estação do Tri-Rail (que é uma meleca). Então ligamos para a State Farm para pedir um serviço de recuperação de bateria. Eles não fazem o serviço e nos transferiram para um terceiro, uma empresa de guincho. As pessoas da empresa de guincho não conheciam o endereço da estação do Tri-Rail. É o equivalente, em São Paulo, a dizer:

- Oi, eu preciso de um guincho, estou na estação de metrô da Barra Funda.
- Senhor, eu preciso do endereço
- Grr... Okay, é na Marquês de S. Vicente
- Que número?
- Ah, a estação é grande, é entre o 1000 e o 1500
- Senhor, eu preciso do número exato
- 1232.7645
- Senhor?
- Sim?
- Esse número não existe.
- Tenta sem o decimal
- Também não existe, senhor.
- Então tenta 1233
- Ah, funcionou. Tem algum ponto de referência próximo?
- Acho que tem uma estação do metrô, serve?
- Sim, estação de metrô é um ótimo ponto de referência, fica bem fácil de achar. Próximo de qual estação o senhor está?

Depois disso, começou o inferno da cobrança.

- Senhor, qual é a forma de pagamento?
- Quais são as minhas escolhas?
- Dinheiro ou cartão.
- Quanto vai ser?
- $75 dólares. (A State Farm reembolsa).
- Cartão, não ando com isso em dinheiro.
- Qual o número do cartão?
- XXX...
- Qual o tipo do cartão
- YYY
- Pode repetir o número?
- XXX
- Qual o seu nome?
- Lucas Perin
- Berin?
- Perin.
- Derin?
- Perin. P-E-R-I-N.
- Denim, como o jeans?
- Perin, com P de elefante.
- Senhor?
- Esquece. Vou pagar em dinheiro.
- Ah, ok... (digitando). Senhor, perdi o endereço. Vamos ter que começar tudo de novo.

Desnecessário dizer que a essas alturas a Ilanah já tinha ido no K-Mart e comprado um cabo. Acabei cancelando o chamado. Juro que cancelo o seguro também, tão logo eu possa.

Corrompido pelo Eric (http://ericcosta.43people.com), comprei um Moleskine

O Moleskine é um caderno fresco com capa de couro. Com essa descrição, provavelmente vou receber um montão de hate mail. :)

Como é caro para um caderno($10), virou minha carteira oficial. Vamos ver como funciona.