# Doing CCA/CVA in Julia with MultivariateStats.jl package - how to get canonical vectors?

**URL:** <https://discourse.julialang.org/t/doing-cca-cva-in-julia-with-multivariatestats-jl-package-how-to-get-canonical-vectors/43626>\
**Category:** General Usage\
**Created:** [July 24, 2020, 3:48pm UTC](https://discourse.julialang.org/t/doing-cca-cva-in-julia-with-multivariatestats-jl-package-how-to-get-canonical-vectors/43626 "2020-07-24T15:48:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cheins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cheins/32/10391_2.png) [@cheins](https://discourse.julialang.org/u/cheins)\
**Post date:** [July 24, 2020, 3:48pm UTC](https://discourse.julialang.org/t/doing-cca-cva-in-julia-with-multivariatestats-jl-package-how-to-get-canonical-vectors/43626/1 "2020-07-24T15:48:14Z")

</div>

I am using the `fit(CCA,...)` function from the `MultivariateStats.jl` package and I want to know how to pull out the principal canonical vectors. The resulting `CCA` model object has methods like `xprojection` and `yprojection` which respectively give you the projection matrices that map the two random variables (the inputs `X` and `Y` ) into their common, correlation-maximizing subspace. But I don’t know how to simply extract the canonical vectors for each variable themselves, because I’m not familiar enough with the maths behind CCA/CVA to know how to compute them using the projection matrices and/or the ‘mean vectors’ (which is another provided method of the `CCA` object).

---

<div class="post-metadata">

**Author:** ![mattarnoldbio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattarnoldbio/32/36233_2.png) [@mattarnoldbio](https://discourse.julialang.org/u/mattarnoldbio)\
**Post date:** [August 4, 2022, 10:09am UTC](https://discourse.julialang.org/t/doing-cca-cva-in-julia-with-multivariatestats-jl-package-how-to-get-canonical-vectors/43626/2 "2022-08-04T10:09:32Z")

</div>

Just wondering if you ever worked out how to do this, or found good examples/documentation outside of the readthedocs page?
