Hi,
here's the code I am using to calculate contributions for the principal component
----------------------
group g1 x y z
g1.makepcomp(scale=normload, cor, eigval=v1, eigvec=m1, cproport) f1 f2 f3
scalar s=@csum(v1)
scalar l1=v1(1,1)/s
scalar l2=v1(1,2)/s
scalar l3=v1(1,3)/s
series F1_XYZ=f1
'creating the backcaluclation for f1 analysis
'step 1: creating the normalized values
for %y x y z
series n{%y}=({%y}-@mean({%y}))/@stdev({%y})
next
'step 2:back-calculate the contributions
series X_c=nx*m1(1,1)
series Y_c=ny*m1(2,1)
series Z_c=nz*m1(3,1)
smpl 2000M01 2019M12
group XYZ_PCA F1_XYZ x_c y_c z_c
XYZ_PCA.mixed line(F1_XYZ) stackedbar(x_c, y_c, z_c) line(F1_XYZ)
----------------------
Problem,
the stacked bars do not match the line perfectly.
Worse still, they match better if I cut the sample to only the years that I have all the data for (i.e. where I have a full matrix).
Shouldn't they match? Isn't PCA normalizing loadings just the way I did in backcalculation?
Shouldn't eviews be cutting the sample to the years where it has a full matrix itself and not produce different results if I don't adjust the sample myself?
Thank you
calculating contributions to the principal component
Moderators: EViews Gareth, EViews Moderator
Return to “Econometric Discussions”
Who is online
Users browsing this forum: No registered users and 2 guests
