Zongshan, Li | 1 Dec 03:20
Picon

a question of Data quotation

Dear the friends of R-Ecology:
     I am a beginner for R language, therefore I am sure that this question is possibly quite simple, but it still
mean a big problem to me.
      I select two columns of 'npp' to combine a new variable:data, and give its colnames as jan and feb, the code is following:

      data<-cbind(npp$JAN,npp$FEB)
      colnames(data)<-c("jan","feb")

      I found that the columns of 'data',could not quoted as 'data$jan',or'data$feb',but can quoted well as
data[,1] or data[,2].

      Tips of R-software is 'data$jan : $ operator is invalid for atomic vectors'

      I try to use the function 'as.matrix' convert the data to numeric type,but get the just same result. I am
confused about this problem.  

Any help is strongly appreciated,
thank you in advance,


Zongshan, Li£¬zsli_st <at> rcees.ac.cn
2009-12-01 
Research Center for Eco-Environmental Sciences,Chinese Academy of Sciences
Shuangqing Road, Haidian street, Beijing, 100085
Tel: 86-10-13699145748
QQ: 1141958023
email: zsli_st <at> rcees.ac.cn
website: http://www.rcees.ac.cn/  

	[[alternative HTML version deleted]]
(Continue reading)

Christian Parker | 1 Dec 06:35
Picon
Favicon

Re: a question of Data quotation

Zongshan,

When you use cbind, R will combine them as a matrix and unfortunately 
the $ way of indexing columns does not work for matrices. A better way 
to get what you want would be like this:

data<-data.frame(jan=npp$JAN,feb=npp$FEB)

Hope this helps,
Chris

Zongshan, Li wrote:
> Dear the friends of R-Ecology:
>      I am a beginner for R language, therefore I am sure that this question is possibly quite simple, but it still
mean a big problem to me.
>       I select two columns of 'npp' to combine a new variable:data, and give its colnames as jan and feb, the code
is following:
>
>       data<-cbind(npp$JAN,npp$FEB)
>       colnames(data)<-c("jan","feb")
>
>       I found that the columns of 'data',could not quoted as 'data$jan',or'data$feb',but can quoted well as
data[,1] or data[,2].
>
>       Tips of R-software is 'data$jan : $ operator is invalid for atomic vectors'
>
>       I try to use the function 'as.matrix' convert the data to numeric type,but get the just same result. I am
confused about this problem.  
>
> Any help is strongly appreciated,
(Continue reading)

Johannes Signer | 1 Dec 08:48
Picon

Re: a question of Data quotation

You could also do:

data <- cbind(1:10, 1:10)
colnames(data) <- c("a","b")
data <- as.data.frame(data)
then data$a works fine

all the best J
On Tue, Dec 1, 2009 at 3:20 AM, Zongshan, Li <zsli_st@...> wrote:

> Dear the friends of R-Ecology:
>     I am a beginner for R language, therefore I am sure that this question
> is possibly quite simple, but it still mean a big problem to me.
>      I select two columns of 'npp' to combine a new variable:data, and give
> its colnames as jan and feb, the code is following:
>
>      data<-cbind(npp$JAN,npp$FEB)
>      colnames(data)<-c("jan","feb")
>
>      I found that the columns of 'data',could not quoted as
> 'data$jan',or'data$feb',but can quoted well as data[,1] or data[,2].
>
>      Tips of R-software is 'data$jan : $ operator is invalid for atomic
> vectors'
>
>      I try to use the function 'as.matrix' convert the data to numeric
> type,but get the just same result. I am confused about this problem.
>
> Any help is strongly appreciated,
> thank you in advance,
(Continue reading)

Picon
Gravatar

how to calculate "axis variance" in metaMDS, pakage vegan?

Hi Hi there,

I am trying to use funcion metaMDS (vegan pakage) for Community Ecology
data, but I find no way to calculate the "expressed variance" of the first 2
axis? is there a way to do that?
Thanks a lot in advance,

Gian

	[[alternative HTML version deleted]]
gabriel singer | 1 Dec 11:45
Picon
Picon
Favicon

Re: how to calculate "axis variance" in metaMDS, pakage vegan?

hi gian,

no, there is no such way. A MDS can´t express "explained variance". 
However, the stress value is the overall measure of quality of fit of 
your MDS to the data. There are various measures of stress, but loosely 
speaking you can regard the stress as a percentage of  variation NOT 
explained by ALL dimensions in your MDS.

cheers, g

Gian Maria Niccolò Benucci wrote:
> Hi Hi there,
>
> I am trying to use funcion metaMDS (vegan pakage) for Community Ecology
> data, but I find no way to calculate the "expressed variance" of the first 2
> axis? is there a way to do that?
> Thanks a lot in advance,
>
> Gian
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@...
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>
>
(Continue reading)

Jari Oksanen | 1 Dec 11:52
Picon
Picon
Favicon

Re: how to calculate "axis variance" in metaMDS, pakage vegan?

On 1/12/09 11:12 AM, "Gian Maria Niccolò Benucci" <gian.benucci@...>
wrote:

> Hi Hi there,
> 
> I am trying to use funcion metaMDS (vegan pakage) for Community Ecology
> data, but I find no way to calculate the "expressed variance" of the first 2
> axis? is there a way to do that?
> Thanks a lot in advance,
>
Gian,

Why nobody asks how to calculate the non-linear stress of PCA or RDA?
Non-linear stress would make just as little sense for PCA or RDA as the axis
variance makes for NMDS. The axis variance is purely a measure of PCA family
of methods (even CA family has a bit different measure), and there is no
meaningful way of calculating "expressed variance" for NMDS axes (and
indeed, a separate axis is not meaningful for NMDS: it is the configuration
spanned by all axes together that makes sense).

Cheers, Jari Oksanen
Picon
Gravatar

Re: how to calculate "axis variance" in metaMDS, pakage vegan?

Okey, really many thanks... So having low Stress value is foundamental, as
it is as lower as higher the model fit the data, is that right? How can I
know if my Stress is correct? I mean, if it is enough low to asses that the
model fit good the samples data shifts into the graph...
Is there a treshold or something?
I would appreciate any pdf or kind of reviews on ordination models for
community ecology data... :)
Thank you really much!
Cheers,

Gian

2009/12/1 Gian Maria Niccolò Benucci <gian.benucci@...>

> Hi Hi there,
>
> I am trying to use funcion metaMDS (vegan pakage) for Community Ecology
> data, but I find no way to calculate the "expressed variance" of the first 2
> axis? is there a way to do that?
> Thanks a lot in advance,
>
> Gian
>
>
>

--

-- 
Dr. Gian Maria Niccolò Benucci
Department of Applied Biology - University of Perugia
Borgo XX Giugno, 74
(Continue reading)

gabriel singer | 1 Dec 12:13
Picon
Picon
Favicon

Re: how to calculate "axis variance" in metaMDS, pakage vegan?

gian,

you may try consecutive MDS-analyses with increasing number of 
dimensions (the parameter k in the isoMDS() or metaMDS() function). then 
plot stress against the number of dimensions and judge similar to a 
scree-plot in PCA. this should tell you how many dimensions to use for 
the MDS and as such also an appropriate associate stress-value.

cheers, gabriel

Gian Maria Niccolò Benucci wrote:
> Okey, really many thanks... So having low Stress value is foundamental, as
> it is as lower as higher the model fit the data, is that right? How can I
> know if my Stress is correct? I mean, if it is enough low to asses that the
> model fit good the samples data shifts into the graph...
> Is there a treshold or something?
> I would appreciate any pdf or kind of reviews on ordination models for
> community ecology data... :)
> Thank you really much!
> Cheers,
>
> Gian
>
>
> 2009/12/1 Gian Maria Niccolò Benucci <gian.benucci@...>
>
>   
>> Hi Hi there,
>>
>> I am trying to use funcion metaMDS (vegan pakage) for Community Ecology
(Continue reading)

Maria Dulce Subida | 1 Dec 13:23
Picon

Re: how to calculate "axis variance" in metaMDS, pakage vegan?

Hi!

According to Clarke and Warwick (Clarke, K. R. and Warwick, R. M. 2001. 
Change in marine communities: an approach to statistical analysis and 
interpretation. PRIMER-E, Plymouth) you could consider the following 
rough rule-of-thumb:
stress< 0.05: excellent representation; stress < 0.1: good 
representation, although the fine structure of any compact groups may 
deserve closer examination; stress < 0.2: acceptable representation, 
though for values at the upper end of this range conclusions should be 
compared with those from an alternative mehtod (e.g. cluster analysis); 
stress > 0.3: unsatisfactory representation, indicating that the points 
are close to being placed in random positions.
Nevertheless you should take into account that the stress usually 
increases with increasing quantity of data.

HTH

Cheers,

Maria Dulce Subida

Gian Maria Niccolò Benucci escribió:
> Okey, really many thanks... So having low Stress value is foundamental, as
> it is as lower as higher the model fit the data, is that right? How can I
> know if my Stress is correct? I mean, if it is enough low to asses that the
> model fit good the samples data shifts into the graph...
> Is there a treshold or something?
> I would appreciate any pdf or kind of reviews on ordination models for
> community ecology data... :)
(Continue reading)

Victor Landeiro | 1 Dec 15:36
Picon

Re: how to calculate "axis variance" in metaMDS, pakage vegan?

Dear all,
What about a r2 statistic in this case? I have seen some people using the r2
of the relationship (a matrix regression) between te original distance and
the final distance obtained with the NMDS.
This r2 is not similar to the stress measure, as we can see above:

library(vegan)
data(varespec)
original.dist<-vegdist(varespec)
r2<-numeric(10)
stress<-numeric(10)
for(i in 1:10){
nmds.resu<-metaMDS(varespec,k=i)
nmds.scores<-scores(nmds.resu)
nmds.dist<-dist(nmds.scores)
r2[i]<-summary(lm(original.dist~nmds.dist))[[8]]
stress[i]<-nmds.resu$stress
}
r2     ## r2 initially increase and as more axis are added it begins to
decrease.
stress
plot(r2,stress)

I have read somewhere something like "dont stress about stress", however I
really dont know what is best, stress or r2. People say that this r2 is
something like "how good you recovered the original distances with the NMDS
ordination".
What about this r2 measure?

victor
(Continue reading)


Gmane