Hello to everyone,

I have a panel of 190 industries over the 2000-2018 period. my data-set contains 4 variables (x1-x4) that are correlated and convey similar information. I would like to do a principal component analysis and extract one variable that accounts for the common variability and correlation of the 4 variables. I type the following

Code:
bysort industry: pca x1 x2 x3 x4
the Principal component analysis is done per each industry (which takes same tome, as I have 190). Then i try to predict a single component, as on average it seems to explain the variation of the x1-x4. I type the following:

Code:
bysort industry: predict p1, score
of course, i get the message

Code:
predict may not be combined with by
r(190);
i read in some previous tread that principal component "pays no attention to panel structure"

https://www.statalist.org/forums/for...-in-panel-data

Should I give up on the PCA analysis in a panel data setting. One option is to split my dataset by industry and do PCA analysis 190 times, which is nonsense.


Any suggestions?