mercredi 21 février 2018

R - subset only columns with significant intercepts?

I'm working on portfolio analysis, and for one part I run the same regression for 30 different stocks (one per column). After this I want to create a subset (a portfolio to be evaluated in the next step) cointaing only the stocks for which the intercept in the estimated model was significantly different from 0 at the 5% level. Is there any nice way to do this using if or ifelse and a loop? Now that I'm analyzing 30 stocks I could do it manually, but I would like to use my code to analyze a greater dataset in a little while.

Thank you!

Aucun commentaire:

Enregistrer un commentaire