Example 1: Case where explanatory variables are known in advance
Suppose we want to predict the sales of a product based on advertising expenditure and the price of the product. In this case, we already know the values of advertising expenditure and the price when we build the prediction model. We can collect historical data of previous sales along with the corresponding advertising expenditure and price for each period. Using this historical data, we can build a regression model where sales is the dependent variable and advertising expenditure and price are the explanatory variables. The model can be used to predict future sales based on the known values of advertising expenditure and price.
Example 2: Case where explanatory variables are not known in advance
Let's consider the task of predicting stock prices. Here, the explanatory variables could include various factors such as economic indicators, company-specific news, social media sentiment, etc. In this case, the values of these explanatory variables are not known in advance when building the prediction model. We can collect historical stock prices along with the corresponding values of the explanatory variables for each period. Using this historical data, we can build a predictive model such as a time series analysis or machine learning algorithm. Once the model is built, it can be used to predict future stock prices based on the values of the explanatory variables that will become available in the future.