[R] 3 dimensional MDS plots
Calla Carbone
6cc4 at queensu.ca
Thu Mar 10 21:38:52 CET 2011
Hi,
I am trying to create 3 mds plots: one with axis 1 vs axis 2, one with axis 2 vs axis 3, and one with axis 1 vs axis 3. When inputting my code, I only end up with one diagram and when inputting
mdsg.mds$dims, the program returns 2 for 2 dimensions. How can I create the other two plots?
Any help would be greatly appreciated,
Calla Carbone
The table I use is number of each taxa on each surface and is attached.
-------------- next part --------------
Below is a copy of my work:
>mdsg=read.csv(file.choose(), header=TRUE, row.names=1, sep=",")
> mdsg.mds<- metaMDS(sp.rich)
Error in metaMDS(sp.rich) : object 'sp.rich' not found
> mdsg.mds<- metaMDS(mdsg)
Square root transformation
Wisconsin double standardization
Run 0 stress 10.62813
Run 1 stress 14.73774
Run 2 stress 11.19939
Run 3 stress 10.61520
... New best solution
... procrustes: rmse 0.005646588 max resid 0.009332332
Run 4 stress 10.61520
... New best solution
... procrustes: rmse 0.0001009763 max resid 0.0001754211
*** Solution reached
> mdsg.mds.ALT<- metaMDS(mdsg, distance="euclidean", k=3, trymax=50, autotransform=FALSE)
Run 0 stress 3.020817
Run 1 stress 0.00673153
... New best solution
... procrustes: rmse 0.09349157 max resid 0.2443702
Run 2 stress 0.008861757
... procrustes: rmse 0.08275172 max resid 0.1932439
Run 3 stress 0.006908548
... procrustes: rmse 0.0447681 max resid 0.1093436
Run 4 stress 0.007621072
... procrustes: rmse 0.05445531 max resid 0.1437309
Run 5 stress 0.005675308
... New best solution
... procrustes: rmse 0.1021018 max resid 0.2694876
Run 6 stress 0.008473566
... procrustes: rmse 0.1411485 max resid 0.3583789
Run 7 stress 0.008235768
... procrustes: rmse 0.05178896 max resid 0.1487678
Run 8 stress 0.009192125
... procrustes: rmse 0.1135218 max resid 0.3126878
Run 9 stress 0.00984179
... procrustes: rmse 0.1117180 max resid 0.3110542
Run 10 stress 0.00942402
... procrustes: rmse 0.08053243 max resid 0.2261970
Run 11 stress 0.008956116
... procrustes: rmse 0.06461741 max resid 0.1729917
Run 12 stress 0.00871519
... procrustes: rmse 0.08382491 max resid 0.2297745
Run 13 stress 0.006883284
... procrustes: rmse 0.05259355 max resid 0.1339228
Run 14 stress 0.007745699
... procrustes: rmse 0.1032920 max resid 0.2410554
Run 15 stress 0.009062592
... procrustes: rmse 0.07324642 max resid 0.2127011
Run 16 stress 0.006311344
... procrustes: rmse 0.1242246 max resid 0.3201084
Run 17 stress 0.00679012
... procrustes: rmse 0.05894517 max resid 0.1699838
Run 18 stress 0.00892886
... procrustes: rmse 0.0886889 max resid 0.2505874
Run 19 stress 0.007831356
... procrustes: rmse 0.04815574 max resid 0.1443481
Run 20 stress 0.008307666
... procrustes: rmse 0.08109922 max resid 0.2286835
Run 21 stress 0.009738125
... procrustes: rmse 0.04494221 max resid 0.0853707
Run 22 stress 0.006648893
... procrustes: rmse 0.0714659 max resid 0.180198
Run 23 stress 0.008319666
... procrustes: rmse 0.1326991 max resid 0.3451491
Run 24 stress 0.007369039
... procrustes: rmse 0.1406218 max resid 0.3560638
Run 25 stress 0.006693668
... procrustes: rmse 0.06047182 max resid 0.1445884
Run 26 stress 0.007021456
... procrustes: rmse 0.06223025 max resid 0.1552082
Run 27 stress 0.008450277
... procrustes: rmse 0.06290812 max resid 0.1474387
Run 28 stress 0.007949867
... procrustes: rmse 0.06185912 max resid 0.1779437
Run 29 stress 0.007607591
... procrustes: rmse 0.0791691 max resid 0.2204299
Run 30 stress 0.007450255
... procrustes: rmse 0.1027691 max resid 0.2798933
Run 31 stress 0.006476469
... procrustes: rmse 0.02180973 max resid 0.04587615
Run 32 stress 0.008423953
... procrustes: rmse 0.05009894 max resid 0.1326238
Run 33 stress 0.009818617
... procrustes: rmse 0.1293366 max resid 0.3352202
Run 34 stress 0.009782313
... procrustes: rmse 0.02056321 max resid 0.04534656
Run 35 stress 0.007691246
... procrustes: rmse 0.06954554 max resid 0.1907627
Run 36 stress 0.009071507
... procrustes: rmse 0.03511019 max resid 0.08272775
Run 37 stress 0.00867032
... procrustes: rmse 0.03915756 max resid 0.08640346
Run 38 stress 0.008109802
... procrustes: rmse 0.04896411 max resid 0.09568495
Run 39 stress 0.0065526
... procrustes: rmse 0.07546078 max resid 0.1902766
Run 40 stress 0.007617851
... procrustes: rmse 0.02149247 max resid 0.0493953
Run 41 stress 0.007433552
... procrustes: rmse 0.03954261 max resid 0.07601604
Run 42 stress 0.008697543
... procrustes: rmse 0.1110775 max resid 0.2855709
Run 43 stress 0.006243913
... procrustes: rmse 0.0806811 max resid 0.2283781
Run 44 stress 0.008474417
... procrustes: rmse 0.1519882 max resid 0.3552259
Run 45 stress 0.0083211
... procrustes: rmse 0.0727077 max resid 0.1767035
Run 46 stress 0.008051925
... procrustes: rmse 0.06954848 max resid 0.172751
Run 47 stress 0.009271762
... procrustes: rmse 0.09332512 max resid 0.2182002
Run 48 stress 0.009197149
... procrustes: rmse 0.104169 max resid 0.2856122
Run 49 stress 0.00656145
... procrustes: rmse 0.04243012 max resid 0.1266379
Run 50 stress 0.006636944
... procrustes: rmse 0.09853805 max resid 0.2584870
> names(mdsg.mds)
[1] "points" "dims" "stress" "data" "distance" "converged"
[7] "tries" "species" "call"
> mdsg.mds$points
[,1] [,2]
Disc -0.75970137 0.82615812
Johns 1.09698866 -0.42726075
LBW -0.69603453 -0.21063881
Spbay -0.11433730 -0.03734453
BC 0.80952315 0.09556815
D 0.50518560 -0.24053747
E 0.22159986 0.04797842
G -0.40841770 -0.27384498
LMP 0.23686884 1.23858885
PC -0.87625155 -0.64825212
SH -0.01542367 -0.37041488
attr(,"centre")
[1] TRUE
attr(,"pc")
[1] TRUE
attr(,"halfchange")
[1] TRUE
> mdsg.mds$dims
[1] 2
> mdsg.mds$stress
[1] 10.61520
> mdsg.mds$data
[1] "wisconsin(sqrt(mdsg))"
> mdsg.mds$distance
[1] "bray"
> mdsg.mds$converged
[1] TRUE
> mdsg.mds$tries
[1] 4
> mdsg.mds$species
[,1] [,2]
Charnia -0.64803962 -0.25570377
Charniodiscus -0.29435409 0.05427335
Ivesheadia -0.31324619 -0.33485080
Thectardis -0.90038964 -0.63829244
Tree.Frond -0.52192114 -0.15500003
Fractofusus 0.77371091 -0.11631453
Bradgatia -0.04960810 -0.21083582
Pectinifrons 0.04014456 -0.32244681
Aspidella -0.45120914 0.39904260
Hapsidophylla 0.50383940 -0.17459408
Heimalora -0.10441330 0.62593841
Ostrich.Feather 0.28843372 1.46582729
Feather.Duster 0.01804479 -0.02227495
Tulip.Frond 0.66742592 0.73062070
Trepassia 0.28843372 1.46582729
Beothukis 0.73931198 -0.08363615
Primocandelabrum -0.92508363 0.97772972
Hadryniscala -0.92508363 0.97772972
Blackbrookia 1.33579627 -0.50564841
Frondophyllas 0.28843372 1.46582729
Parviscopa -0.92508363 0.97772972
attr(,"shrinkage")
[1] 0.6744097 0.7139844
attr(,"centre")
[1] 1.788934e-18 -3.794708e-19
attr(,"old.wa")
[1] FALSE
> mdsg.mds$call
metaMDS(comm = mdsg)
> mds1.mds
Call:
metaMDS(comm = mds1)
Nonmetric Multidimensional Scaling using isoMDS (MASS package)
Data: wisconsin(sqrt(mds1))
Distance: bray
Dimensions: 2
Stress: 9.804838
Two convergent solutions found after 3 tries
Scaling: centring, PC rotation, halfchange scaling
Species: expanded scores based on ?wisconsin(sqrt(mds1))?
> variableScores<- mds1.mds$species
> sampleScores<- mds1.mds$points
> plot(mds1.mds)
> plot(mds1.mds, type="n")
> text(mds1.mds, display=c("sites"), choices=c(1,2), col="blue", cex=0.7)
> points(mds1.mds, display=c("species"), choices=c(1,2), pch=3, col="red")
More information about the R-help
mailing list