我用ropls包畫PCA, PLS DA, OPLS DA圖,但是數據導入出了些問題。
> data
sample calss X.2.methoxyethoxy.propanoic.acid X.gamma.Glu.Leu.Ile
1? asss1? ? 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6.8? ? ? ? ? ? ? ? 5.9
2? asss2? ? 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.5? ? ? ? ? ? ? ? 3.6
3 assss3? ? 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.6? ? ? ? ? ? ? ? 3.8
4? asss4? ? 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2.8? ? ? ? ? ? ? ? 3.9
5 assdd4? ? 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4.7? ? ? ? ? ? ? ? 4.1
6? sdv6? ? 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4.6? ? ? ? ? ? ? ? 4.2
7? ghj7? ? 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4.5? ? ? ? ? ? ? ? 4.3
8? fdg9? ? 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4.4? ? ? ? ? ? ? ? 5.1
我的數據導入后是這樣的,但是運行畫圖命令后出來了個error:
> pca <- opls(data)
Error: 'x' data frame must contain columns of 'numeric' vectors only
然后我就把first and second column刪掉(因為第二列數據沒用),沒想到出現一個
warning:
> data.exp <- data[,c(-1, -2)]
> pca <- opls(data.exp)
Warning message:
Single component model: only 'overview' and 'permutation' (in case of
single response (O)PLS(-DA)) plots available
也順帶出來了一些數據和一個圖,結果這個圖是空白,只有橫縱坐標
> pca
PCA
8 samples x 3 variables
standard scaling of predictors
R2X(cum) pre ort
Total? ? 0.704? 1? 0
我問作者是不是數據有什么格式要求,就按照上面的格式給作者郵件,作者回復:
The model tells you that one component is sufficient (ie the second one is
not bringing useful information).
If, however, you want to compute additional components (ie 2 components to
display the score plot), you can set the predI argument (eg to 2 or more
instead of the NA default value).
他說一個成分足夠了,但是我沒有得到圖怎么辦呢?加主成分這個建議在SIMCA軟件里面也
有,不過我用別的包(muma包)不需要加主成分做出的PCA圖有3個主成分,只是只能出圖,
沒有上面那些R2X數據。
我該怎么修改我的數據格式好呢?如有描述不足或者不當請多多指教