bnaras / PMA

4 stars 3 forks source link

Centering issue sPCA #11

Open cicadawing opened 7 months ago

cicadawing commented 7 months ago

Hi there,

I get this warning I get when I apply SPC. I ran SPC.cv with centering=TRUE, and did not get this warning. But when I run SPC with centering=TRUE, I get the warning below.

I just wanted to confirm whether SPC applies centering in SPC and SPC.cv, or whether users have to center the data prior to input? In which case I would just be a bit concerned about data leakage for SPC.cv in particular (ie. following the iterative deflation method in particular).


> regularisation_values <- seq(1, sqrt(ncol(x)), len=30)

> PC1_regularisation_cv <- SPC.cv(as.matrix(x), sumabsvs=regularisation_values, nfolds=10, trace=TRUE, center=TRUE, niter=100, orth=TRUE)

 Fold  1  out of  10

 Fold  2  out of  10

 Fold  3  out of  10

 Fold  4  out of  10

 Fold  5  out of  10

 Fold  6  out of  10

 Fold  7  out of  10

 Fold  8  out of  10

 Fold  9  out of  10

 Fold  10  out of  10

> PC1_regularisation_cv$nfolds

[1] 10

> best_reg <- PC1_regularisation_cv$bestsumabsv1se

> PC_regularisation_cv_applied <- SPC(as.matrix(x), sumabsv=best_reg, K=25, center=TRUE, orth=TRUE, cnames=colnames(x))

1234567

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

1234567891011121314151617181920

Warning message:

In PMDL1L1(x, sumabsu = sqrt(nrow(x)), sumabsv = sumabsv, niter = niter,  :

  PMDL1L1 was run without first subtracting out the mean of x.

Best wishes

T