HI Kevin,
Thank you so much for getting back to me.
So this is what I did:
I extracted just my covariates in data frame (without previously calculated PCs for my UKB data)
and it looks like this:
> head(a)
sex age td array HBA1C
1: 1 58 -9 1 29.8
2: 1 57 -9 2 0.0
3: 1 66 -9 1 28.1
4: 1 65 2 1 65.3
5: 2 51 -9 1 30.7
6: 2 64 2 1 0.0
Then I calculated PCs only for those covariates and determined the proportion of variance explained via:
scaled_df <- apply(a, 2, scale)
a.cov <- cov(scaled_df)
a.eigen <- eigen(a.cov)
PVE <- a.eigen$values / sum(a.eigen$values)
> PVE
[1] 0.2750932 0.2031598 0.1936860 0.1867781 0.1412830
you can see that none of the covariates (sex age td array HBA1C) contributes largely to variance...Does that mean I keep all of them?
Also what about calculating Principal components for my genomic data ( I already got calculated PCs for that from UKB) how do I select there how many to keep? Is "scree" plot in R valuable estimation there?
And yes it is Diabetic Retinopathy :)