2d rotation: vegan?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

2d rotation: vegan?

Randall Morris-Ostrom
I've been working at interpreting the results of a non-metric multidimensional scaling analysis. I have been using metaMDS in the vegan package because one of the benefits is that it also rotates to solution to its principal components. (Eventually I realized that there is no reason why my results would be most interpretable when aligned along the PC, but it was a nice starting point.)

I have been trying to find ways to rotate the resulting plot so I can visualize it differently and look at actual plot positions (as opposed to just rotating the print outs I have been looking at.) I'm able to find lots of suggestions for how to rotate3d plots, but almost nothing for 2d. I have tried using the MDSrotate function in vegan, but really it comes down to the fact that I'm clueless when I try to make sense of the documentation. *somewhat embarrassed*  My goal is basically to rotate the plot and exam the structure as a tool to generate theories about the meaning of the different dimensions (the interpretation of the clusters in my research are crystal clear.)

I generated a little fake data, just so there would be a plot. I've been trying to figure out how to do this as either just a simple scatterplot or using the vegan package.

Thank you for your time,
Randy

Randall Morris-Ostrom J.D., M.S.
Doctoral Candidate in Psychology,
University of St. Thomas
[hidden email]


Sample Code

library(vegan)
set.seed(12345)
x <- rnorm(1:10)
y <- rnorm(1:10)
df <- data.frame(x,y)
d <- dist(df, method = "euclidean")
nmds <- metaMDS(df, distance = "euclidean", k = 2)
plot(nmds)
# or
nmdp <- as.data.frame(nmds$points)
plot(nmdp$MDS1, nmdp$MDS2)
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: 2d rotation: vegan?

William Revelle
Randall,
  You might try the factor.rotate function in the psych package.  That will allow you to “hand rotate” any solution where (in your example) nmdp is a matrix.

You also could look at the the various rotations available in the GPArotation package.

Bill

> On Feb 13, 2015, at 9:08 AM, Randall Morris-Ostrom <[hidden email]> wrote:
>
> I've been working at interpreting the results of a non-metric multidimensional scaling analysis. I have been using metaMDS in the vegan package because one of the benefits is that it also rotates to solution to its principal components. (Eventually I realized that there is no reason why my results would be most interpretable when aligned along the PC, but it was a nice starting point.)
>
> I have been trying to find ways to rotate the resulting plot so I can visualize it differently and look at actual plot positions (as opposed to just rotating the print outs I have been looking at.) I'm able to find lots of suggestions for how to rotate3d plots, but almost nothing for 2d. I have tried using the MDSrotate function in vegan, but really it comes down to the fact that I'm clueless when I try to make sense of the documentation. *somewhat embarrassed*  My goal is basically to rotate the plot and exam the structure as a tool to generate theories about the meaning of the different dimensions (the interpretation of the clusters in my research are crystal clear.)
>
> I generated a little fake data, just so there would be a plot. I've been trying to figure out how to do this as either just a simple scatterplot or using the vegan package.
>
> Thank you for your time,
> Randy
>
> Randall Morris-Ostrom J.D., M.S.
> Doctoral Candidate in Psychology,
> University of St. Thomas
> [hidden email]
>
>
> Sample Code
>
> library(vegan)
> set.seed(12345)
> x <- rnorm(1:10)
> y <- rnorm(1:10)
> df <- data.frame(x,y)
> d <- dist(df, method = "euclidean")
> nmds <- metaMDS(df, distance = "euclidean", k = 2)
> plot(nmds)
> # or
> nmdp <- as.data.frame(nmds$points)
> plot(nmdp$MDS1, nmdp$MDS2)
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

William Revelle           http://personality-project.org/revelle.html
Professor           http://personality-project.org
Department of Psychology   http://www.wcas.northwestern.edu/psych/
Northwestern University   http://www.northwestern.edu/
Use R for psychology             http://personality-project.org/r
It is 3 minutes to midnight   http://www.thebulletin.org

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.