PCA plotted for same trajectory using two different software has difference

Issue #646 resolved
exchhattu created an issue

Hi Bio3D,

I accidentally posted Issue #645 without using markdown therefore I requested another issue for same question. Please ignore or delete Issue #645.

I generated PCA using Gromacs. Later, I found bio3d package and am impressed by its simplicity and user-friendliness for MD analysis. Therefore, I have started to use it and computed PCA. After projecting the snapshots into PCA subspace, I found the difference. First five snapshots are shown in the tables. A trend is similar for entire trajectory.

GROMACS generated projection (nm)

SN PC1 PC2
1 2.01515 0.15200
2 2.89946 -1.34934
3 1.87425 0.23617
4 1.63961 0.76003
5 0.90918 2.17062

Bio3D generated projection

SN PC1 PC2
1 -20.1535551535521 -1.53137220354993
2 -28.9957972175446 13.4866462107036
3 -18.7430155734459 -2.37174087332255
4 -16.3898777344419 -7.61623760143872
5 -9.08356004683468 -21.7176721873223

By looking at the first row generated by both methods, I can see the difference. First, one order of magnitude difference is due to the unit (nm vs angstrom). Second, minus in a projection by one method has plus by another method. I got confused and wondering whether there is something wrong.

Does anybody have any explanation on it?

Thank you in advance.

Comments (5)

  1. Xinqiu Yao

    Hi,

    It is pretty normal if the sign of a eigenvector or projection is opposite in PCA, due to potential numerical errors, as long as the sign is constantly opposite for every element. Remember an eigenvector (or principal component, PC) represents a concerted motion, in which going forward or backward describes the same motion. Therefore, changing the sign doesn't change conclusions at all. The one order of magnitude difference is because the unit, as you just said. So, the results from Gromacs and Bio3D are consistent.

  2. Log in to comment