Dear Mr. Kothari
I have used your function FTD.comm to successfully calculate functional diversity for a set of communities in my study area. Having done this I wanted to determine whether the functional diversity I observe in each of my communities is more or less than expected when accounting for the species richness of each site. To do this I run null models in the picante package using a trial swap null model to generate 999 random matrices, maintaining the species richness of each community, and the frequency of occurrence for each species. I do this by using the following code;
replicate (999, randomizeMatrix(my.matrix, null.model = "trialswap", iterations = 1000))
The picante package has existing functions which allow for certain metrics to be easily applied to this function and calculated across the randomized communities. However, as the metric which is calculated using your code is recent and independent of the picante package I have attempted to (unsuccessfully) apply this code across my randomized matrices.
One of my attempts goes as follows:
FTD.rand <- FTD.comm((randomizeMatrix(spmat, null.model = "trialswap", iterations = 1000)), tdmat) obs.null.output <- cbind(FTD.comm(tdmat, spmat), replicate(999, FTD.rand(spmat)))
However whenever I try this I get Error message:
Error in rowSums(spmat) : 'x' must be an array of at least two dimensions
I have tried defining spmat as an array of 999 random matrices, as well as defining spmat as a randomized matrix and then replicating the FTD.comm function 999 times, however both approaches are unsuccessful.
Is there a function in the FD package in which this FTD.comm function can be applied to a null model? Do I need to adapt an apply function to use the metric across randomized matrices? Or do I need to fiddle with the actual FTD.comm function itself in order for it to be applicable across the randomized matrices I generate.
Any help with this matter would be greatly appreciated, as applying my metrics to a null model are crucial to my study in order to understand the underlying processes which shape the observed community structure. I am also a relatively inexperienced and limited coder with regards to such matters so I apologize in advance if I have bothered you with something trivial or have, conversely, asked too much of you. If you need any more information or indeed more code samples you are more than welcome to use either this forum or my personal email address.
Kind Regards,
Nikhail
Dear Mr. Kothari
I have used your function
FTD.commto successfully calculate functional diversity for a set of communities in my study area. Having done this I wanted to determine whether the functional diversity I observe in each of my communities is more or less than expected when accounting for the species richness of each site. To do this I run null models in the picante package using a trial swap null model to generate 999 random matrices, maintaining the species richness of each community, and the frequency of occurrence for each species. I do this by using the following code;replicate (999, randomizeMatrix(my.matrix, null.model = "trialswap", iterations = 1000))The picante package has existing functions which allow for certain metrics to be easily applied to this function and calculated across the randomized communities. However, as the metric which is calculated using your code is recent and independent of the picante package I have attempted to (unsuccessfully) apply this code across my randomized matrices.
One of my attempts goes as follows:
FTD.rand <- FTD.comm((randomizeMatrix(spmat, null.model = "trialswap", iterations = 1000)), tdmat) obs.null.output <- cbind(FTD.comm(tdmat, spmat), replicate(999, FTD.rand(spmat)))However whenever I try this I get Error message:
Error in rowSums(spmat) : 'x' must be an array of at least two dimensionsI have tried defining
spmatas an array of 999 random matrices, as well as definingspmatas a randomized matrix and then replicating theFTD.commfunction 999 times, however both approaches are unsuccessful.Is there a function in the
FDpackage in which thisFTD.commfunction can be applied to a null model? Do I need to adapt anapplyfunction to use the metric across randomized matrices? Or do I need to fiddle with the actualFTD.commfunction itself in order for it to be applicable across the randomized matrices I generate.Any help with this matter would be greatly appreciated, as applying my metrics to a null model are crucial to my study in order to understand the underlying processes which shape the observed community structure. I am also a relatively inexperienced and limited coder with regards to such matters so I apologize in advance if I have bothered you with something trivial or have, conversely, asked too much of you. If you need any more information or indeed more code samples you are more than welcome to use either this forum or my personal email address.
Kind Regards,
Nikhail