美文网首页
来求个助,请各位点开看看画PCA图的数据导入问题

来求个助,请各位点开看看画PCA图的数据导入问题

作者: 大宝贝喜欢徐先生 | 来源:发表于2017-10-19 22:02 被阅读267次

    我用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数据。

    我该怎么修改我的数据格式好呢?如有描述不足或者不当请多多指教

    相关文章

      网友评论

          本文标题:来求个助,请各位点开看看画PCA图的数据导入问题

          本文链接:https://www.haomeiwen.com/subject/vdgpuxtx.html