miércoles, 24 de julio de 2013

To LED or not to LED? To LED it is!

Light-emitting diodes (LEDs) have become a family matter to me. I remember how back in 2011 I was assisting at a technology fair in Catalunya, explaining all the benefits of LED bulbs and their tremendous efficiency to astonished public. Back then, common people were just unaware that a 5W led could provide the same light as its 60-80W incandescent counterpart, while serving for years with no need for change or reparation. As Catalonian public is very ecology-oriented, and Catalunya was one of the first geographical spots to pioneer recycling, people were also pleased to hear that LEDs contain no mercury and therefore do not contaminate the environment. A LED chip can be fully recycled - just like a computer chip.

Naturally, all the bulbs in my household are LEDs. :-)

Now people are well aware of all these benefits, the magic has gone as becoming normality, which is a good thing. The LED market is increasing very fast, and apparently it will continue growing. 

This is very well seen on the example of the US market, where the LED mogul CREE is traded publicly on NASDAQ exchange. As you can see, the last six months have shown constant growth, and the prices have climbed from 40.85 to 70.03 USD per share: 


Comparing the CREE shares performance to the general industry performance, as opposing CREE shares to the NASDAQ Composite index, which is one of the best descriptors for technology, it can be seen that CREE has definitely outperformed the market during the last 6 months: 




As you can see from Reuters, analysts generally suggest buying/holding CREE shares.  

In Europe, the main centre for trading LED stocks is Börse Frankfurt, where CREE is traded as well and is showing the same fast and constant growth

In France, however, no LED companies so far are openly in trade, with the exception of, may be, Lyon-based Prismaflex which is listed in Euronext Paris. This company is centered on the printing business, but it also produces outdoor LED signs. Below you can see the comparative behavior of Prismaflex stocks as opposed to the French CAC40 index within the last 6 months:



There is a drastic increase in the stocks performance during the last month, but I cannot track the specific reasoning behind that in the news. 

Again, there is no purely LED company in Paris stock exchange. Nevertheless, there might or might not be one that I know that could be the first. The French-based company Lucibel, a global LED manufacturer with headquarters in Paris and R&D department in Lyon, has been operating on the market since 2008. It is a private company, but it might go for an IPO in the near future. According to the last company report, it has grown 285% in the first half of 2013. During his last visit to the enterprise, the President of France François Hollande has called it"exemplary"

I am very looking forward to see this company go public, because according to my personal knowledge, the value of the shares has grown 650% since the day the company was found. It would be really interesting to see how the it will behave on the open market. 

I wish that in the near future portfolio managers could compose a portfolio of LED companies stocks: all in all, it would be both ethical and socially conscious investment! 

... in a beautiful thing...











lunes, 1 de julio de 2013

The Monty Hall and other doors

One person told me recently: "You should to watch more TV!" I literally laughed out loud.

Until I remembered the following. "The Monty Hall Problem", a cornerstone probabilistic problem that is explained as part of both foundation and advanced courses at leading universities, originates nowhere but on the blue TV screen!

Monty Hall (born 1921) is a Canadian TV presenter who hosted the popular TV show "Let's Make a Deal!" for many years. Not only has this show given many Americans an opportunity to bring some valuable stuff or, well, zonks ("useless stuff" - Lyolya) to their homes

image source: http://gameshows.about.com/od/photogalleries/ig/Let-s-Make-a-Deal-2009/LMAD-Zonk-Model-Large.htm

but also it has driven the appearance of a widely discussed mathematical problem in the "American Statistician" magazine in 1975 (thanks to Dr. Steve Selvin).

I personally have been exposed to this problem three times: as a part of my grad course on theory of probability, as a part of my master's course (I believe the subject was called "something something strategies" and they also explained us "The Prisoner's Dillema" and Nash equilibrium stuff within the bounds of this course) and most recently - as a part of my preparations to job interviews.

Apparently, the Monty Hall problem and its derivations are a beloved question of interviewers to quantitative positions in the English-speaking world. Dr. Timothy Falcon Crack has written a very famous book which explains several versions of it.

Briefly, if you haven't followed the link to Amer. Statist., the problem sounds as follows. Monty Hall hosts a show, and you are a participant to it. There are three doors in front of you. You know that there is a prize behind one door, and nothing behind the other two (or, zonks, in "Let's Make a Deal!" terms). You pick a door. Then Monty Hall tells you that he can open another door for you which he knows is empty. After that being done, he will give you a chance to change your mind and pick another door, the one that he has not open yet. The question is: should you rather take the chance and switch or stick to your initial choice?

The correct response is that you should switch, and the fact that this is a counterintuitive decision makes The Monty Hall Problem so famous. Two solutions to this problem are presented in Dr. Crack's book: one of them is simple deduction, and the other one is formal and involves the Bayes' theorem. The solutions can be found elsewhere. The key to the intuitive solution is that you should figure out the the probability that your initial pick is an empty door. Also, there is a graphical solution that I have found online and that I like a lot:

image source: http://math.ucr.edu/~jdp/Monty_Hall/Monty_Hall.html

You might wonder, if there is a derivation to this problem where switching does now yield better odds of winning. Well, there is. In Dr. Crack book, a derivation is proposed when an empty door is revealed to you not by Monty Hall but a random someone from the audience. So, in this case, if they, as Monty Hall, have prior knowledge on distribution behind the doors, you should switch, too. However, when they randomly open a door and it turns out to be empty by chance, you have the probability of 50 percent of winning by switching, and the same probability of winning by not doing so. So, you are indifferent. Therefore, the the most important thing here is whether the person who opens the door knows how the prizes are distributed or not.

This is an all Bayesian problem. :-)

The Monty Hall problem reminds me a lot of a book that I used to love a s a child. Raymond Smullyan's "The Lady or the Tiger" contains a whole set of logical puzzles of a similar kind, together with other interesting brainteasers.  However, I remember that when I was ten, "the-princess-or-the-tiger" part of the book (the one that actually narrates the stories of prisoners thrown into a quest of life-or-death) seemed totally engrossing to me.

The Smullyan's approach to the Monty Hall show is not probabilistic rather than logical. You have a set of trials (hello, clinical researchers!), each subsequent harder than the previous one, in each of which a prisoner has to pick a door. The door can either have a princess behind it (it is noteworthy to mention that this is a lucky outcome), a tiger, and, in some trials, an empty room. Moreover, there are shields to these doors that inform about what is behind them. They either tell the truth or not - depending on what/who is inside. Sometimes, they can even not be attached to the doors at all! Anyway, you can get away with the information you have each time, and at each trial save your life, happily resolving the puzzle and marrying a princess.  If you were the ninth prisoner, your fate would look like that:


I have encountered this picture on the internets, if you wonder what some other trials look like, try the Amazon sample of the book.

Doors is quite a popular topic for brainteasers, and you can find various problems in books, folklore and the internets - like this one, for instance. Doors can be seen as an allegory for real-life decision processes, and the difference between stochastic and logical approaches to the doors problem is that the first handles situations of total randomness, while the other one is deterministic, indicating that there is a "correct" solution, and you only have to be smart enough to find it. I believe that people, when not knowing in which situation they are, prefer to believe that they are the deterministic one. When no unambiguous indicators are given, people tend to look for "sings". And I probably do so myself, too, despite that I have been specifically trained to estimate the odds of any outcome. We are all optimists.

viernes, 5 de abril de 2013

Vacational thoughts!


Greetings from California,

I am is San Francisco, however, I don't see that too many people would speak Spanish here. Yes, I know it's America, but doesn't the name of the city itself call for Spanish?

Lately, I have been deeply involved into a Coursera course on Financial Engineering and Risk Management, where the brilliant Dr. Emmanuel Derman is a guest lecturer. I signed up for the course after having read his book, My Life as a Quant, which I find a delightful literature piece and a valuable source of practical information if you happen to be in the field. This book is strongly recommended to all who has not read it, and I will be definitely posting a review-entry on why I find this book so amazing.

Spoiler alert: this book is inspiring for all of us who got too far with our hardcore scientific training, to the point where common sense whispers: "Give it up, get a job and do the real thing!" while the perfectionist's approach to everything and the bad habit of doing everything to its very end does not let us let it go. The book shows us light in the end of the tunnel.

Don't blame me, academia, you are amazing, and you are the driving force for all. But you know you got efficiency issues, right?

Yesterday I had an interesting conversation with a San Francisco-based person working in finance at a high level, and I heard the opinion that Russia's stocks (as represented by the RTS index) get less and less dependent on oil every year. It has been said that now the connection (call it correlation if you wish) is less than 50 per cent. Is this statement arguable?

Have a wonderful weekend!




viernes, 18 de enero de 2013

An R tip: string-to-time conversion on non-English machines

Hi, guys,

The next two paragraphs are bla-bla-bla, so if you've come here for an R tip please kindly scroll them. Thank you.

I have been absent from my blog for a while now, although I have promised myself to write at least once every two weeks. The reason for my not complying with this plan is that I have a belief that purely technical posts are barely interesting. You tech guys have your own research going on, and probably won't dig into mine, although the majority of stuff I post here is fun, not work. Nevertheless, it is truly hard to write about statistics and research and still keep it an entertaining piece of entry for a general reader. As myself. I try to do my best, really.

So, now I find myself in France (who could think of it, right?), specifically - in Lyon, and I am looking for a job. I have a pending offer in Barcelona which I am very willing to take, but the assessment process is not finished yet, so I sit tight waiting for the resolution. I have been clearly said that the things will be clear by the end of this month. In an unsuccessful outcome of the events, I will be moving to France permanently and intensively look for a job in the area of Lyon (the search area radius is 200 km). If you are my possible employer and have somehow and suddenly made your way up to this blog entry, please don't think that your possible offer is sort of a second best choice for me. It is not, not at all. I am very willing to work as a statistician here in Lyon or as a quant in Geneva or the like. The point is I have my life established in Barcelona already, and I have moved out and about a lot, no, A LOT in the past three years, and I speak a really basic French (yet), so I am just very scared to change the things again. Although deep inside I know that it will surely work out. France is actually nice, much nicer than you could guess as looking at it from the exterior. What the hell am I doing in Lyon? It is simple: my husband has a really good job here, and we have a flat and stuff, and a circle of friends, so it is easy for me to get settled here or in the surroundings. 

Ok, so now to an R tip.

As a person from Spain, I have my computer in Spanish. So my software is in Spanish, too, including the spreadsheet processing programs (I use Numbers and OpenOffice) and R.

Now imagine you have to do some analysis with a time-series, and you have your computer in a language other than English. You read your data from a .csv file, and in an R object your time-series date notions will appear like:


"1-dic-98"

This is because your spreadsheet programs are too smart and are taking care of you, and they want you to read the "01/12/1998" or even the 912501753 in a suitable-for-human format. In Spain, everything is adapted to a suitable-for-an-Iberian-human format, so even Eros Ramazzotti sings his songs in Spanish. Which can be a little tricky when you have to process data with R. 

In order to convert your data frame to a time-series format (ts, or zoo, or zooreg), you'll have to have your dates in a time format (POSIXct and POSIXlt or yearmon). You'll most probably do it with the function strptime, which has not been translated into Spanish yet. So it will just not understand the notions: 

"dic", "ene", "abr" and "ago"

What you could do here? Three things: 
  • change your R language to English (I personally won't do that)
  • use Excel to convert .xls to .csv and specifically indicate it that the dates should be numerical
  • use the function sub in R to replace a part (pattern) in a string


The latter solution is the easiest and a true time-saver. With just four lines of code, you're done:



Voilà! Now you can proceed with the strptime in a usual way.

P.S. If you have a French machine, with its abbreviations: "jan", "fév", "mar", "avr", "mai", "jun", "jul", "aoû", "sep", "oct", "nov", "déc" - it will take you five lines of code.