Add variable vectors to NMDS plot which visualizes observations.
I’m not sure how to add vectors that visualize the effect of data set parameters to an NMDS plot.
Using the example provided by matlab for function mdscale (shown below), I can create the figure with points for each observation (i.e. cerials of a certain brand). How would I go about adding vectors to the plot for each of the parameters included in the analysis, where the length of the vector indicates the strength of effect on the ordination. For the cerial example, these vectors would represent calories, protien, fat, sodium, fiber, carbo, sugars, shelf, potass, and vitamins. If you could show my how to do this in the sample below, that would be really helpful!
load cereal.mat
X = [Calories Protein Fat Sodium Fiber …
Carbo Sugars Shelf Potass Vitamins];
% Take a subset from a single manufacturer
mfg1 = strcmp(‘G’,cellstr(Mfg));
X = X(mfg1,:);
dissimilarities = pdist(zscore(X),’cityblock’);
[Y,stress] =…
mdscale(dissimilarities,2,’criterion’,’stress’);
plot(Y(:,1),Y(:,2),’o’,’LineWidth’,2);
gname(Name(mfg1))I’m not sure how to add vectors that visualize the effect of data set parameters to an NMDS plot.
Using the example provided by matlab for function mdscale (shown below), I can create the figure with points for each observation (i.e. cerials of a certain brand). How would I go about adding vectors to the plot for each of the parameters included in the analysis, where the length of the vector indicates the strength of effect on the ordination. For the cerial example, these vectors would represent calories, protien, fat, sodium, fiber, carbo, sugars, shelf, potass, and vitamins. If you could show my how to do this in the sample below, that would be really helpful!
load cereal.mat
X = [Calories Protein Fat Sodium Fiber …
Carbo Sugars Shelf Potass Vitamins];
% Take a subset from a single manufacturer
mfg1 = strcmp(‘G’,cellstr(Mfg));
X = X(mfg1,:);
dissimilarities = pdist(zscore(X),’cityblock’);
[Y,stress] =…
mdscale(dissimilarities,2,’criterion’,’stress’);
plot(Y(:,1),Y(:,2),’o’,’LineWidth’,2);
gname(Name(mfg1)) I’m not sure how to add vectors that visualize the effect of data set parameters to an NMDS plot.
Using the example provided by matlab for function mdscale (shown below), I can create the figure with points for each observation (i.e. cerials of a certain brand). How would I go about adding vectors to the plot for each of the parameters included in the analysis, where the length of the vector indicates the strength of effect on the ordination. For the cerial example, these vectors would represent calories, protien, fat, sodium, fiber, carbo, sugars, shelf, potass, and vitamins. If you could show my how to do this in the sample below, that would be really helpful!
load cereal.mat
X = [Calories Protein Fat Sodium Fiber …
Carbo Sugars Shelf Potass Vitamins];
% Take a subset from a single manufacturer
mfg1 = strcmp(‘G’,cellstr(Mfg));
X = X(mfg1,:);
dissimilarities = pdist(zscore(X),’cityblock’);
[Y,stress] =…
mdscale(dissimilarities,2,’criterion’,’stress’);
plot(Y(:,1),Y(:,2),’o’,’LineWidth’,2);
gname(Name(mfg1)) nmds MATLAB Answers — New Questions