# Analysis of Lumber Prices Time Series Using Long Short-Term Memory Artificial Neural Networks

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. Time Series Analysis

#### 2.1.1. Cross-Validation for Time Series Dataset

#### 2.1.2. The Great Recession (2007–2009)

#### 2.1.3. The COVID-19 Recession (2020–)

#### 2.2. Long Short-Term Memory Recurrent Neural Network

- At time step t (t = 1, 2, …, T), given hidden state h
_{t−1}past cell c_{t−1}from the last time step t − 1 and current input x_{t}, the forward pass of LSTM is executed by first computing the updated memory cell č_{t}:$$\u010d=tanh\left({W}_{cx}{x}_{t}+{W}_{ch}{h}_{t-1}+{b}_{c}\right)$$ - The input gate i
_{t}controls how much information in č will flow through the new memory c_{t}, and a forget gate f_{t}is introduced to control what information in the previous cell c_{t−1}should be remembered:$${i}_{t}=\sigma \left({W}_{ix}{x}_{t}+{W}_{ih}{h}_{t-1}+{b}_{i}\right)$$$${f}_{t}=\sigma \left({W}_{fx}{x}_{t}+{W}_{fh}{h}_{t-1}+{b}_{f}\right)$$$${c}_{t}={i}_{t}{\u010d}_{t}+{f}_{t}{c}_{t-1}$$ - The output gate o
_{t}determines which part of the memory cell c_{t}should flow into the hidden state h_{t}:$${o}_{t}=\sigma \left({W}_{ox}{x}_{t}+{W}_{oh}{h}_{t-1}+{b}_{o}\right)$$$${h}_{t}={o}_{t}tanh\left({c}_{t}\right)$$

#### 2.3. Training and Evaluation

^{−3}and reduced by a factor of 0.1 when the training loss stalled for 80 epochs. We stopped training when the training loss reached a plateau for 100 consecutive epochs. We trained the model on a single NVidia graphical processing unit (GPU).

_{i}are the predicted values, y

_{i}, are the actual values, and N is the number of observations.

## 3. Results and Discussion

^{−3}, 6.35 × 10

^{−4}, and 6.94 × 10

^{−4}for 30, 60, and 120 timesteps, respectively. For the COVID-19 recession period, the MSE after training were 1.15 × 10

^{−4}, 1.43 × 10

^{−4}, and 1.34 × 10

^{−4}for 30, 60, and 120 timesteps, respectively. Furthermore, it is valid to infer that the models would perform relatively well on unseen data.

#### 3.1. The Great Recession Period Analysis

#### 3.2. COVID-19 Recession Analysis

## 4. Conclusions

## 5. Disclaimer

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Alsharef, A.; Banerjee, S.; Uddin, S.M.J.; Albert, A.; Jaselskis, E. Early Impacts of the COVID-19 Pandemic on the United States Construction Industry. Int. J. Environ. Res. Public Health
**2021**, 18, 1559. [Google Scholar] [CrossRef] [PubMed] - Fowke, C. National Association of Home Builders (NAHB) Warns That Record-High Lumber Prices Could Drive Up Housing Costs. Builder Online. 9 October 2020. Available online: https://www.builderonline.com/builder-100/leadership/nahb-warns-that-record-high-lumber-prices-could-drive-up-housing-costs (accessed on 25 March 2021).
- Hassan, M.R.; Nath, B. Stock market forecasting using hidden Markov model: A new approach. In Proceedings of the 5th International Conference on Intelligent Systems Design and Applications (ISDA’05), Warsaw, Poland, 8–10 September 2005; pp. 192–196. [Google Scholar]
- Trading Economics. Available online: https://tradingeconomics.com/commodity/lumber (accessed on 1 July 2020).
- Howard, J.L.; Westby, R.M.U.S. Timber Production, Trade, Consumption and Price Statistics 1965–2011; United States Department of Agriculture Forest Service: Washington, DC, USA, 2013; pp. 1–91.
- Ramage, M.H.; Burridge, H.; Busse-Wicher, M.; Feredaya, G.; Reynolds, T.; Shaha, D.U.; Wud, G.; Yuc, L.; Fleminga, P.; Densley-Tingley, D.; et al. The wood from the trees: The use of timber in construction. Renew. Sustain. Energy Rev.
**2017**, 68, 333–359. [Google Scholar] [CrossRef] - Nagarajan, K.; Prabhakaran, J. Prediction of Stock Price Movements using Monte Carlo Simulation. Int. J. Innov. Technol. Explor. Eng. IJITEE
**2019**, 8, 2012–2016. [Google Scholar] - Adebiyi, A.A.; Adewumi, A.O.; Ayo, C.K. Comparison of ARIMA and artificial neural networks models for stock price prediction. J. Appl. Math.
**2014**, 2014, 1–7. [Google Scholar] [CrossRef] [Green Version] - Tadayon, M.; Pottie, G.J. Predicting student performance in an educational game using a hidden Markov model. IEEE Trans. Educ.
**2020**, 63, 299–304. [Google Scholar] [CrossRef] - White, H. Economic prediction using neural networks: The case of IBM daily stock returns. ICNN
**1988**, 2, 451–458. [Google Scholar] - Chiang, W.C.; Urban, T.L.; Baldrige, G.W. A neural network fund net asset approach to mutual value forecasting. Omega
**1996**, 24, 205–215. [Google Scholar] [CrossRef] - Kim, S.H.; Chun, S.H. Graded forecasting using an array of bipolar predictions: Application of probabilistic neural networks to a stock market index. Int. J. Forecast.
**1998**, 14, 323–337. [Google Scholar] [CrossRef] - Bandara, K.; Bergmeir, C.; Smyl, S. Forecasting across time series databases using recurrent neural networks on groups of similar series: A clustering approach. Expert Syst. Appl.
**2018**, 140, 112896. [Google Scholar] [CrossRef] [Green Version] - Verizon Media—Yahoo! Finances. Available online: https://finance.yahoo.com/quote/LBS%3DF/history?p=LBS%3DF (accessed on 5 September 2020).
- Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-learn machine learning in Python. J. Mach. Learn. Res.
**2011**, 12, 2825–2830. [Google Scholar] - National Bureau of Economic Research. Available online: https://www.nber.org/news/business-cycle-dating-committee-announcement-june-8-2020 (accessed on 22 August 2020).
- Ng, S.; Wright, J.H. Fact and challenges from the great recession for forecasting and macroeconomic modeling. J. Econ. Lit.
**2013**, 51, 1120–1154. [Google Scholar] [CrossRef] [Green Version] - Rich, R. The Great Recession. 2013. Available online: https://www.federalreservehistory.org/essays/great-recession-of-200709 (accessed on 15 July 2020).
- National Bureau of Economic Research. NBER Determination of the February 2020 Peak in Economic Activity. Available online: https://www.nber.org/sites/default/files/2020-11/june2020 (accessed on 30 July 2020).
- Gopinath, G. The Great Lockdown: Worst Economic Downturn Since the Great Depression; International Monetary Fund: Washington, DC, USA, 2020; Available online: https://blogs.imf.org/2020/04/14/the-great-lockdown-worst-economic-downturn-since-the-great-depression/ (accessed on 15 July 2020).
- Hochreiter, S.; Schmidhuber, J. LSTM can solve hard long-time lag problems. In Advances in Neural Information Processing Systems 9, Proceedings of the Annual Conference on Neural Information Processing Systems, Denver, CO, USA, 2–5 December 1996; NIPS: Islamabad, Pakistan, 1996; pp. 473–479. [Google Scholar]
- Gers, F.A.; Schmidhuber, J. Recurrent nets that time and count. In Proceedings of the IEEE-INNS-ENNS International Joint Conference on Neural Networks, IJCNN 2000, Neural Computing: New Challenges and Perspectives for the New Millennium, Como, Italy, 24–27 July 2000; Volume 3, pp. 189–194. [Google Scholar]
- Gers, F.A.; Schmidhuber, J.; Cummins, F. Learning to forget: Continual prediction with LSTM. In Proceedings of the 1999 Ninth International Conference on Artificial Neural Networks ICANN 99, Edinburgh, UK, 7–10 September 1999; pp. 850–855. [Google Scholar]
- Abadi, M.; Agarwal, A.; Barham, P.; Brevdo, E.; Chen, Z.; Citro, C.; Corrado, G.S.; Davis, A.; Dean, J.; Devin, M.; et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv Prepr.
**2016**, arXiv:1603.04467. [Google Scholar] - Chollet, F. Keras. GitHub. 2015. Available online: https://github.com/keras-team/keras (accessed on 9 July 2020).
- Bouktif, S.; Fiaz, A.; Ouni, A.; Serhani, M.A. Optimal deep learning LSTM model for electric load forecasting using feature selection and genetic algorithm: Comparison with machine learning approaches. Energies
**2018**, 11, 1636. [Google Scholar] [CrossRef] [Green Version] - Lusk, V. The Market Crash of 2008 Explained. Wealthsimple. 2020. Available online: https://www.wealthsimple.com/en-us/learn/2008-market-crash (accessed on 27 July 2020).

**Figure 1.**Evolution of training set (

**a**) and testing set (

**b**) over time for the Random Length stock price for the great recession modeling.

**Figure 2.**Evolution of training set (

**a**) and testing set (

**b**) over time for the Random Length stock price for the COVID-19 recession modeling.

**Figure 4.**Long Short-term Memory (LSTM) models with (

**a**) 30 timesteps, (

**b**) 60 timesteps, and (

**c**) 120 timesteps.

**Figure 5.**Model performance for (

**a**) great recession and (

**b**) COVID-19 pandemic during training for each timesteps.

**Figure 6.**Great recession prediction using LSTM for (

**a**) 30 timesteps, (

**b**) 60 timesteps, and (

**c**) 120 timesteps. Shaded area represents standard deviation.

**Figure 7.**COVID-19 recession period prediction using LSTM for (

**a**) 30 timesteps, (

**b**) 60 timesteps, and (

**c**) 120 timesteps. Shaded area represents standard deviation.

Set | Min ^{1} | Max ^{2} | Mean | Std. Dev ^{3} | Skewness | Kurtosis |
---|---|---|---|---|---|---|

Training | 184.6 | 464 | 292.92 | 57.09 | 0.57 | −0.330 |

Testing | 138.1 | 270.1 | 211.26 | 35.02 | −0.38 | −1.11 |

^{1}Min: minimum.

^{2}Max: maximum;

^{3}Std. dev: standard deviation.

Set | Min ^{1} | Max ^{2} | Mean | Std. Dev ^{3} | Skewness | Kurtosis |
---|---|---|---|---|---|---|

Training | 163.6 | 651 | 319.25 | 80.45 | 0.88 | 1.42 |

Testing | 259.8 | 928 | 444.72 | 150.38 | 1.43 | 1.47 |

^{1}Min: minimum.

^{2}Max: maximum;

^{3}Std. dev: standard deviation.

Timesteps | Metric | Folds | Average | ||||
---|---|---|---|---|---|---|---|

1 | 2 | 3 | 4 | 5 | |||

30 | MSE ^{1} | 0.0039 | 0.0019 | 0.0019 | 0.0008 | 0.0010 | 0.0019 |

RMSE ^{2} | 0.0630 | 0.0440 | 0.0439 | 0.0286 | 0.0316 | 0.04222 | |

MAE ^{3} | 0.0479 | 0.0303 | 0.0305 | 0.0207 | 0.0230 | 0.03048 | |

60 | MSE | 0.0051 | 0.0017 | 0.0014 | 0.0009 | 0.0009 | 0.002 |

RMSE | 0.071 | 0.0422 | 0.0374 | 0.0301 | 0.0303 | 0.0422 | |

MAE | 0.0552 | 0.0290 | 0.0260 | 0.0218 | 0.0220 | 0.0308 | |

120 | MSE | 0.0043 | 0.0014 | 0.0011 | 0.0007 | 0.0010 | 0.0017 |

RMSE | 0.0659 | 0.0379 | 0.0333 | 0.0273 | 0.0325 | 0.03938 | |

MAE | 0.0531 | 0.0270 | 0.0237 | 0.0198 | 0.0236 | 0.02944 |

^{1}MSE: Mean Squared Error.

^{2}RMSE: Root Mean Square Error;

^{3}MAE: Mean Absolute Error.

Timesteps | Metric | Folds | Average | ||||
---|---|---|---|---|---|---|---|

1 | 2 | 3 | 4 | 5 | |||

30 | MSE ^{1} | 0.0371 | 0.0175 | 0.0099 | 0.0135 | 0.0050 | 0.0166 |

RMSE ^{2} | 0.1926 | 0.1324 | 0.0999 | 0.1162 | 0.0708 | 0.1223 | |

MAE ^{3} | 0.1276 | 0.0696 | 0.0549 | 0.0620 | 0.0416 | 0.0711 | |

60 | MSE | 0.0451 | 0.0105 | 0.0177 | 0.0122 | 0.0034 | 0.0177 |

RMSE | 0.2125 | 0.1026 | 0.1333 | 0.1106 | 0.0583 | 0.1234 | |

MAE | 0.1517 | 0.0590 | 0.0751 | 0.0607 | 0.0377 | 0.0768 | |

120 | MSE | 0.051 | 0.0064 | 0.0185 | 0.0137 | 0.0037 | 0.0186 |

RMSE | 0.2258 | 0.0804 | 0.1363 | 0.1173 | 0.0613 | 0.1242 | |

MAE | 0.1642 | 0.0459 | 0.0764 | 0.0636 | 0.0391 | 0.0778 |

^{1}MSE: Mean Squared Error.

^{2}RMSE: Root Mean Square Error;

^{3}MAE: Mean Absolute Error.

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Verly Lopes, D.J.; Bobadilha, G.d.S.; Peres Vieira Bedette, A.
Analysis of Lumber Prices Time Series Using Long Short-Term Memory Artificial Neural Networks. *Forests* **2021**, *12*, 428.
https://doi.org/10.3390/f12040428

**AMA Style**

Verly Lopes DJ, Bobadilha GdS, Peres Vieira Bedette A.
Analysis of Lumber Prices Time Series Using Long Short-Term Memory Artificial Neural Networks. *Forests*. 2021; 12(4):428.
https://doi.org/10.3390/f12040428

**Chicago/Turabian Style**

Verly Lopes, Dercilio Junior, Gabrielly dos Santos Bobadilha, and Amanda Peres Vieira Bedette.
2021. "Analysis of Lumber Prices Time Series Using Long Short-Term Memory Artificial Neural Networks" *Forests* 12, no. 4: 428.
https://doi.org/10.3390/f12040428