# PCA on one time series variable into components

**URL:** <https://discourse.julialang.org/t/pca-on-one-time-series-variable-into-components/95915>\
**Category:** Statistics\
**Created:** [March 11, 2023, 2:15pm UTC](https://discourse.julialang.org/t/pca-on-one-time-series-variable-into-components/95915 "2023-03-11T14:15:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [March 11, 2023, 2:15pm UTC](https://discourse.julialang.org/t/pca-on-one-time-series-variable-into-components/95915/1 "2023-03-11T14:15:43Z")

</div>

I tried to use PCA from MultivariateStats, and I got a little bit stuck.

I have a one-time series variable - Y.  
I need to decompose it into orthogonal factors (by using PCA).  
It looks like a number of factors can be larger than the dimension.

Can anybody help me, please?

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [March 11, 2023, 2:19pm UTC](https://discourse.julialang.org/t/pca-on-one-time-series-variable-into-components/95915/2 "2023-03-11T14:19:38Z")

</div>

To the best of my knowledge, that can’t work. In a time series context, you can think of PCA decomposing the variance-covariance matrix of several time series into a (potentially smaller) set of orthogonal factors that best explain the time series variation of all series simultaneously. If you have only one time series, that is your factor.

I should add that you could still potentially do such a decomposition, but you need some other data+restrictions to discipline it. A Kalman Filter perhaps could be one substitute?

---

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [March 11, 2023, 2:39pm UTC](https://discourse.julialang.org/t/pca-on-one-time-series-variable-into-components/95915/3 "2023-03-11T14:39:11Z")

</div>

Thank you for the answer.

I am sorry, I’ve got my task in the wrong way.

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [March 11, 2023, 8:54pm UTC](https://discourse.julialang.org/t/pca-on-one-time-series-variable-into-components/95915/4 "2023-03-11T20:54:54Z")

</div>

Look at: [GitHub - baggepinnen/SingularSpectrumAnalysis.jl: A package for performing Singular Spectrum Analysis (SSA) and time-series decomposition](https://github.com/baggepinnen/SingularSpectrumAnalysis.jl)  
For a single time series, it’s “PCA of the time series trajectory matrix”
