What data do I need to do time series forecasting?
There are three values that you must know for each data point of your time series:
- its entity, which represents a unique value identifying the time series (e.g., a product SKU). Without this information, it is not possible to construct a sequence of points since there's no logical grouping between the points.
- its timestamp, which represents the moment in time the data point was recorded. Without this information, it is not possible to construct a sequence of points since there's no sequential ordering between the points.
- its target, which represents the measurement of the data point itself that we want to predict. Without this information, we have effectively nothing to base ourselves on.
Such information would look as follow when organized in a table:
Additionally, you may also have recorded additional values at the same time, which can be a useful source of information when trying to predict a time series.
Let see what happened if we removed each of these columns to illustrate their necessity.
Removing the entity effectively leaves us with two values for the same timestamp. If the data was in this format and we were told that each time the timestamp goes below its previous value a new entity was defined, we would be able to reconstruct the initial table with its entity column.
Removing the timestamp gives us the values the entity may take, but we don't know when. Again, if we're told that the rows have been kept in some order, we could reconstruct the timestamp column.
Removing the target column makes this problem impossible to solve. We're left with only the entities that were measured and the time of measurement, but no measurement, which makes the two other values useless.
Why should you read technical books?
Because they can teach you. Good technical books will expand your understanding of the topic covered in the book. It will clarify concepts you had trouble grasping before, allowing you to make good use of this newly acquired knowledge.
Because they give you more abilities. As you acquire new knowledge, you can make use of it. This lets you do things you could not do before because of this lack of knowledge.
Because they can change you. If you read about someone else's approach to problem solving, you may come to prefer their way of solving problems. By being convinced by the author, you may be led to change how you write code, what you think is important about building software, how you prioritize your work, etc.
Why should you read fiction books?
Because they can motivate you. An exciting story to which you can relate may motivate you to try and emulate it.
Because they can make you think. Some authors have been alive for a lot longer than you have and they've had longer to think about certain topics to which you never really dedicated any time. Some may have acquired a deeper and broader understanding of a certain domain they can then use to turn fiction into an epic story.
Because they can help you be more creative. Creativity is in my opinion simply the ability to take what one already knows and arrange it in a way that is novel. Seeing how others arrange things they know in a new and interesting way can help you recognize where you may be too rigid and help you relax when being creative.
Because they can help you disconnect. Reading about someone else's story is a great way to disconnect from our day to day life. If you take the bus, the subway or the train to go to work and back home, it is a great opportunity to spend some time disconnecting. The creation of a buffer where you are immersed in a different realm has had very calming properties on me.
Suggested series: All of the Warcraft/World of Warcraft books, The Three-Body Problem trilogy
What is the value of timestamping all the things?
Adding a temporal reference to everything allows us to contextualize this information. It allows us to better remember the exact moment we took a note, which may in turn help us remember why we took that note.
Timestamping also allows us to have a better idea of how things have come into being sequentially. If you have notes you wrote in different locations and they all have their timestamp, you can gather them and organize them by their timestamp.
Having a creation timestamp on tasks is useful to track how long a task has been opened. It's also useful to determine the recency of a task, as recent tasks generally have more urgency than older tasks, as proven by the fact that the task has aged and is not completed. Having a timestamp on the last modification date allows us to know when it was last updated, giving us a sign this task has been seen and hasn't been discarded yet. Having a completion timestamp allows us to measure how long it takes for tasks to go from creation to completion. Having timestamps on all the events related to the task allows us to know how many task management tasks are necessary for a task to be completed.
Timestamping is useful to predict events. If you have a system (e.g., a store, a computer, a company) and you do a lot of different actions, being able to forecast when is the next time a specific event will occur is useful. It also allows you to forecast events volume (e.g., number of sales, number of actions per employee)
Note: This question was timestamped 2018-04-21 22:14:52.
Should I sell my stocks during the coronavirus crisis?
Most advise that one should invest for the long term and that they should have a diversified portfolio. They mention that many studies demonstrate that it's not possible to time the market.
However, when a crisis as big as the coronavirus hits, it's important to assess its impact on your portfolio as a whole. What kind of assets are you holding? In what industries? What are the impacts the coronavirus might have on that business? How long have these businesses taken to recover from prior crashes (given more weight to the recent ones)? How likely am I wrong in my assessments of the situation?
I currently hold stocks in airline companies. I would assess that air traveling is likely going to take a large hit for most of March and April. Except if the governments were to step in to reduce the bleeding of those companies, I would press the eject button and save whatever money I have left in those stocks. It took about 5 years for airline companies to recover from the 2007-2009 crash. Some companies almost went bankrupt. They definitely recovered and some went to make 4000% from their lowest value.
If you kept your money in those stocks, you would have spent about 7 years of time returning you nothing (ignoring dividends here). Instead, if you sold at any point during the downward movement and bought the stocks at the same price you sold them when they went back, you would have avoided going further down. Furthermore, if you had decided to purchase those stocks at a lower point, it would have taken you less time to make your money back.
Here's an example:
In January 2007 you buy 10 stocks for 60 CAD each, totaling 600 CAD. One year later the stock is worth only 20 CAD. You sell them all. You now have suffered a loss of (60 - 20) x 10 = 400 CAD and have 200 CAD left. Half a year later the stock is now worth 2 CAD. If you had instead decided to sell then, you would have 2 x 10 = 20 CAD, suffering a loss of 580 CAD.
Now, let's see what happens when the stock starts to go up again. Five years later, the stock went from 2 CAD to 20 CAD. Had you sold the stock at 20 CAD, there would be no difference for you. Had you sold the stock at 2 CAD you would have "suffered" the opportunity cost of (20 - 2) x 10 = 180 CAD. If at any point (having sold the stock at 20 CAD) you had decided to buy back the stock, you would be making money, or should I say, recovering from your loss. As an example, if you had bought 20 shares at 10 CAD (for a total of 200 CAD), you would now have 400 CAD. You would still be 200 CAD down the drain from your initial investment, but you would be on your way to recovery.
Three years later the stock price has recovered back to 60 CAD. If you had never sold, investing in this stock would have been a cost of opportunity in investing in other stocks. If you had sold at 20 CAD and started investing when it reached 20 CAD again, you would have made 10 x (60 - 20) = 400 CAD. You would be back to square 1, without any gain or loss. The benefit you would have had during the period you had sold your stock is that you wouldn't have to check if the stock was going lower. Had you however invested your 200 CAD to buy 20 stocks at 10 CAD, you would now have 20 x 60 = 1200 CAD. You would have doubled your money!
In summary, staying in the market during the crash means that you will not make any money while the market recovers, which can take months if not years. If you instead get out at a loss and wait for it to go down, then buy in (let's say after a 10% drop in the price you sold)
This is obviously the optimistic scenario. In the pessimistic case, as you sold your stocks, the stocks would go on to recover immediately and make enormous gains.
My assessment of the options I have and their associated risks:
- Staying in the market and having to wait for months or years for the stocks I own to return to their original value, which implies years of wasted potential for profits on this original investment while at best receiving dividends from companies that have them.
- Leaving the market, at the cost of a loss (which half of it can be used toward your taxes if you live in Canada), at the risk of the market going up again and potentially reducing my loss, or in the worst case, going above my prior profits.
- Reducing my position in stocks that are highly likely to be very impacted by the coronavirus, being a half-half position, where stocks that are expected to still perform during the downward period are kept and those that are too volatile and negative trending are sold as soon as possible.
Note: This is not actual advice. This is only me trying to reason about the situation.