Examining how Wall Street is slowly incorporating more and more Data Science into their stock prediction Models.

## What is Quantitative Analytics?

#### Quantitative Analytics

Quantitative analytics is the process of applying mathematical and statistical techniques to data in order to understand and analyze financial markets. The goal of quantitative analytics is to identify patterns and trends in data so that investors can make better decisions about where to invest their money.

One popular application of quantitative analytics is stock market analysis. By analyzing data on past stock prices, investors can get a sense for what stocks are likely to rise or fall in value and make more informed investment choices. Quantitative analysts also use data on things like company earnings, economic indicators, and global market trends to help them predict future movements in the stock market. One of the biggest headache that quants face daily when they are working with their analytics is the prevention of biases and errors when working with time series data.

## How do Quants analyze stocks?

There is a lot that goes into deciding which stocks to buy or sell, but quants (quantitative analysts) typically employ a number of methods to analyze stock and make predictions. Some common techniques include studying past price trends, using statistical models to identify relationships between different securities, and analyzing corporate filings and news reports. Of course, no one can predict the future with 100% accuracy, but quants try to get as close as possible by doing in-depth analysis. By employing sophisticated methods and constantly tweaked algorithms, they hope to beat the market.

Some of the most common types of models used by quants include regression analysis, time series analysis, and Monte Carlo simulations. Each of these types of models can be used to help answer different sorts of questions.

Regression analysis is a powerful tool for understanding relationships between variables. This type of model can be used to examine how changes in one variable relate to changes in another variable. For example, a quant might use regression analysis to understand how changes in the stock market affect changes in the bond market. Time series analysis is another important tool used by quants. This type of model can be used to examine trends over time.

## How Data Science Came in and helped

Machine learning is a field of artificial intelligence that focuses on giving computer systems the ability to automatically improve with experience. It has been used extensively in various fields, including stock market analysis. Quants, or quantitative analysts, use machine learning to analyze stocks and predict market movements.

There are a variety of ways in which quants use machine learning to analyze stocks. One common method is called supervised learning. This involves using a training dataset, which is a set of data that includes both input values (such as stock prices) and output values (such as whether the stock price went up or down). The training dataset is used to train a machine learning algorithm, which can then be applied to new data in order to make predictions.

#### Resampling Data

When resampling time-series data, you are essentially changing the frequency at which your data is sampled. This can be done for a variety of reasons - to make the data more manageable, to improve its accuracy, or to emphasize certain features of the data. You can go here and get a tool for easy resampling.

There are a number of different resampling methods that can be used, each with its own benefits and drawbacks. The most common resampling methods are:

**nearest neighbor:**This method simply replaces each data point with the nearest neighbor in the new dataset. This is a simple method that doesn't involve any Complex calculations, but it can often result in loss of information.**triangular interpolation:**This method creates new data points by linearly interpolating your dataset.

#### Lookahead Bias

##### Problem

Lookahead bias is a type of confirmation bias that can occur when people assess the probability of future events. Specifically, lookahead bias refers to the tendency for people to overweight the likelihood of an event occurring conditional on some information that becomes available after they have already formed their estimate.

For example, imagine that you are trying to predict next week's weather based on last week's weather. If it rained last Tuesday, Wednesday, and Thursday, then you might be more likely to predict that it will rain again this Tuesday through Thursday. This is an example of lookahead bias because your prediction is based on information (the past few days' worth of rainfall) that became available after you had made your initial prediction

When you are pulling macro data from fred, you have to be careful.

##### Prevention

There are a few ways to prevent lookahead bias in data science. First, you can randomly split your data into training and test sets. This prevents the model from seeing all of the data at once and introduces some randomness that can help reduce overfitting. Second, you can use cross-validation to train your model. This also helps prevent overfitting by training the model on different subsets of the data.

Finally, you can make sure to reset the model state after each epoch or fold of training. This will help ensure that the model doesn't remember previous data points and only uses the current data point to make predictions. By resetting the state, we are essentially training on time series data which can help reduce lookahead bias.

#### Rolling vs Expanding Window

##### Expanding Window

In data science, an expanding window is a time series that has been augmented with new values at its ends. By appending new values to the old values, the new window has a greater range of observations and can be used for further analysis. For example, imagine you are tracking the stock prices of two companies over time. If you want to include the prices from last week in your analysis, you would need to use an expanding window.

An expanding window can be helpful for data analysis because it increases the size of your data set and allows you to explore more patterns. However, it's important to note that expanding windows can also introduce noise into your data set and affect your results.

##### Rolling Window

A rolling window is a technique used in data science and time series analysis. It refers to the way in which data is subsetted or aggregated for analysis. With a rolling window, data is grouped or "windowed" into fixed-length contiguous intervals, typically moving forward in time. This allows for the examination of trends and patterns over specific periods of time, rather than just at a single point in time.

For example, you might use a rolling window of 7 days to examine the average temperature over the past week. This would allow you to see how the temperature has changed day-by-day over the past week. Or you could use a rolling window of 30 days to look at monthly sales figures.

##### Which one should you use?

If you're looking at a time series and want to predict future values, then you would use a rolling window. This means that you take a fixed-size window of timesteps and move it along the timeline as new data comes in, always predicting the next timestep ahead.

If, on the other hand, you're interested in getting all the information out of your data that you can, an expanding window might be a better choice. This means that you start with a small window of timesteps and gradually expand it as more data comes in. You'll end up using all the data points available to make your predictions.

## Comments