[R] Null models of species co-occurrence
I am currently testing species co-occurrence patterns using null models and the oecosimu() function within the vegan() package. My issue is that none of the methods appear to be the ones that I want. The methods listed are r0, r1, r2, r2dtable, swap, tswap. However, I want to know how to go about implementing fixed row algorithms, as suggested in Gotelli 2000 in Ecology. Also, the null models created seem to be incredibly dependent on the 1) burnin and 2) thin values. These are the 1) Number of null communities discarded before proper analysis in sequential methods "swap" and "tswap" and 2) Number of discarded null communities between two evaluations of nestedness statistic in sequential methods "swap" and "tswap". What are the significance of these values? -- View this message in context: http://r.789695.n4.nabble.com/Null-models-of-species-co-occurrence-tp4325097p4325097.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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.
Re: [R] drop columns whose rows are all 0
Another way would be a which statement. good_dataset=data[,which(colSums(data)!=0)] I believe this depends on how the data are structured though. -- View this message in context: http://r.789695.n4.nabble.com/drop-columns-whose-rows-are-all-0-tp4324231p4325474.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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.
Re: [R] Null models of species co-occurrence
Thank you very much. I'll look into the r project listserv you suggested. Unrelated: Ecological Models and Data in R is one of my favorite mathematical ecology textbooks and a fantastic resource. On Tue, Jan 24, 2012 at 9:30 PM, bbolker [via R] < ml-node+s789695n4326186...@n4.nabble.com> wrote: > Dallas drakeresearchlab.com> writes: > > > I am currently testing species co-occurrence patterns using null models > and > > the oecosimu() function within the vegan() package. My issue is that > none of > > the methods appear to be the ones that I want. The methods listed are > r0, > > r1, r2, r2dtable, swap, tswap. However, I want to know how to go about > > implementing fixed row algorithms, as suggested in Gotelli 2000 in > Ecology. > > > > Also, the null models created seem to be incredibly dependent on the 1) > > burnin and 2) thin values. These are the 1) Number of null communities > > discarded before proper analysis in sequential methods "swap" and > "tswap" > > and 2) Number of discarded null communities between two evaluations of > > nestedness statistic in sequential methods "swap" and "tswap". What are > the > > significance of these values? > > You will probably have better luck with this question on the > r-sig-ecology > r-project.org list. > I haven't looked at this stuff in a little while. It sounds from the > ?oecosimu description as though there are some fixed row algorithms (?) > > Methods âr0â, âr1â and âr2â maintain the site (row) > frequencies. Method âr0â fills presences anywhere on the row with > no respect to species (column) frequencies, âr1â uses column > marginal frequencies as probabilities, and âr2â uses squared > column sums. Methods âr1â and âr2â try to simulate original > species frequencies, but they are not strictly constrained. All > these methods are reviewed by Wright et al. (1998). > > It might help in your e-mail to r-sig-ecology if you briefly > describe Gotelli 2000's algorithm, so readers don't necessarily > have to go back to the original source to know (at least approximately) > what you want. > > Ben Bolker > > __ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4326186&i=0>mailing > list > 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. > > > -- > If you reply to this email, your message will be added to the discussion > below: > > http://r.789695.n4.nabble.com/Null-models-of-species-co-occurrence-tp4325097p4326186.html > To unsubscribe from Null models of species co-occurrence, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4325097&code=dGFkLmRhbGxhc0BkcmFrZXJlc2VhcmNobGFiLmNvbXw0MzI1MDk3fDE3ODk2NDQxNzA=> > . > NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://r.789695.n4.nabble.com/Null-models-of-species-co-occurrence-tp4325097p4326236.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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.
Re: [R] Null models of species co-occurrence
Fantastic! I'll avoid the sequential models and will look into the r0 and r1 methods. Thank you. Tad On Wed, Jan 25, 2012 at 3:03 AM, Jari Oksanen [via R] < ml-node+s789695n4326620...@n4.nabble.com> wrote: > Dallas drakeresearchlab.com> writes: > > > > > I am currently testing species co-occurrence patterns using null models > and > > the oecosimu() function within the vegan() package. My issue is that > none of > > the methods appear to be the ones that I want. The methods listed are > r0, > > r1, r2, r2dtable, swap, tswap. However, I want to know how to go about > > implementing fixed row algorithms, as suggested in Gotelli 2000 in > Ecology. > Dallas, > > What do you mean with "fixed row algorithms"? If you mean the the last row > in > Table 2 of Gotelli (Ecology 81, 2606-2621; 2000) labelled "Row sums > fixed", then > these all are in vegan: SIM2 == r0, SIM4 == r1, SIM9 == quasiswap. Not all > cases > of Gotelli's table are included, but could easily be added. > > > > > Also, the null models created seem to be incredibly dependent on the 1) > > burnin and 2) thin values. These are the 1) Number of null communities > > discarded before proper analysis in sequential methods "swap" and > "tswap" > > and 2) Number of discarded null communities between two evaluations of > > nestedness statistic in sequential methods "swap" and "tswap". What are > the > > significance of these values? > > > The *sequential* models *are* dependent on burnin and thin: you change > data very > little in one step so that matrices are dependent in the sequence. The > help page > for null models contains information how to analyse this with R tools. The > easiest solution is not to use sequential models, but to use > non-sequential > quasiswap. > > Like Ben Bolker wrote, you'd probably get better response in > r-sig-ecology. > > Cheers, Jari Oksanen > > __ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4326620&i=0>mailing > list > 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. > > > -- > If you reply to this email, your message will be added to the discussion > below: > > http://r.789695.n4.nabble.com/Null-models-of-species-co-occurrence-tp4325097p4326620.html > To unsubscribe from Null models of species co-occurrence, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4325097&code=dGFkLmRhbGxhc0BkcmFrZXJlc2VhcmNobGFiLmNvbXw0MzI1MDk3fDE3ODk2NDQxNzA=> > . > NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://r.789695.n4.nabble.com/Null-models-of-species-co-occurrence-tp4325097p4327474.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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.
Re: [R] Multiple line-plot
I think this is what you are getting at. Hope this helps. #index data to determine what low and high levels of tvHrs are (I said anything over 15 hours is considered 'high') index=which(tvHrs > 15) #Plot the first plot, which is the 'high', only using values from crimeDvp that are in 'index' (corresponding to high levels of tvHrs plot(prop.table(table(crimeDvp[index])),type='b',ylab='percent',xlab='crime dev',col='red') lines(prop.table(table(crimeDvp[-index])),type='b', col='black') lines(prop.table(table(crimeDvp)),type='b',col='green') legend("topright", inset=.05, title="TV consume", c("high","low","all"), fill=c('red','black','green')) -- View this message in context: http://r.789695.n4.nabble.com/Multiple-line-plot-tp4394539p4395262.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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.
Re: [R] Problems with Cosine Similarity using library(lsa)
The as.matrix (and as.table or as. vector or as.numeric ...) command takes the object that you wish to convert as an argument. So the code below will actually perform the conversion from table to matrix. > newmatrix<- as.matrix(matrix_v3) A way to see what form your data are taking is to use the command typeof(object). In this case, you can write >typeof(matrix_v3) Easy fix (hopefully) Tad -- View this message in context: http://r.789695.n4.nabble.com/Problems-with-Cosine-Similarity-using-library-lsa-tp4413433p4415114.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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.
Re: [R] help filtering points from a scatterplot
I believe this is what you want to do, though it may need tweaking. #Make up some data > a=seq(1,100,by=1) > b=runif(100,0,0.5) #Make a matrix > matrix=cbind(a,b) #Subset the matrix based upon values of interest > subsetmatrix=matrix[which(b<0.1),] #Plot values > > plot(subsetmatrix[,2]~subsetmatrix[,1],ylim=c(0,1),las=1,ylab='Explan',xlab='Window') Hope this helps. -- View this message in context: http://r.789695.n4.nabble.com/help-filtering-points-from-a-scatterplot-tp4415833p4417247.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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.
Re: [R] help filtering points from a scatterplot
Okay. I think I understand now. You would just like nothing to be plotted for the points below a certain threshold but there will still be that space indexing where the point would've gone. I hope I have this right. So what you could do to fix that is to make a new matrix (still including all the data) and then make values above a certain threshold NA. #Make up some data > a=seq(1,100,by=1) > b=runif(100,0,0.5) #Make a matrix > matrix=cbind(a,b) #Make values above a threshold = NA > newmatrix=matrix > newmatrix[,2][which(newmatrix[,2]<0.1)]<-NA #Plot values > plot(newmatrix[,2]~newmatrix[,1], ylim=c(0,1), las=1, ylab='Explan', > xlab='Window') Okay. You just solved it. I'll still post this if you would like to use it. Tad -- View this message in context: http://r.789695.n4.nabble.com/help-filtering-points-from-a-scatterplot-tp4415833p4418169.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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.