o DCCA (detrended canonical
> correspondence analysis) but the unconstrained DCA. If anyone knows the
> answer for Jonathan's question, please, share it with me, I would also be
> interested.
> Best regards,
>
> Attila
>
> Peter Solymos ezt írta (időpont: 2020. nov. 5., Cs
Jonathan,
Have you checked ?vegan::decorana (it is also mentioned in the vignette on
p 2: https://cran.r-project.org/web/packages/vegan/vignettes/intro-vegan.pdf
)
Cheers,
Peter
On Thu, Nov 5, 2020 at 11:03 AM Jonathan Gordon
wrote:
> Hello,
>
> I’m aiming to perform a detrended canonical
R >= 4.0 will treat categorical variables as character
(stringsAsFactors=FALSE is the new default) when importing via e.g.
read.table(). If you want factors, you have to make it explicit either as
Torsten showed or by setting stringsAsFactors=TRUE.
Cheers,
Peter
On Tue, Jun 23, 2020 at 10:05 AM
Manuel,
There are few ecology focused packages besides ARIMA() and the forecast
package, for example:
- popbio (based mostly on the Matrix Population Models by Caswell (2001)
and Quantitative Conservation Biology by Morris and Doak (2002).
- PVAClone, that uses JAGS and is based on Nadeem, K.,
Gian,
Once you have your samples by OTU matrix row standardized, you can use a
level of your hierarchy (a vector matching the columns) and the
groupSums(your-matrix, 2, your-groups) function in the mefa4 package to get
your relative abundances.
Cheers,
Peter
Gian Maria Niccolò Benucci
is not very
big but I worked with thousands of OTUs) will have this problem.
Do you have an idea how to deal with this kind of data object?
Thank you,
Gian
On 25 June 2015 at 11:51, Peter Solymos soly...@ualberta.ca
javascript:; wrote:
Gian,
Once you have your samples by OTU matrix
Hi Saifi,
Here is how you can set up your design variables to be used in the formula
interface of multipart() or adipart() in vegan. You need to adjust the
settings and make sure that the results make sense, because you know the
data.
library(vegan)
# x - structure(...) # just copied your data
Jason,
The segments in 'mefa' just add a 3rd dimension to the object, but that
does not limit accessing the stored information. Sample attributes can have
spatial information, but it is not specifically designed to support spatial
analysis. More concrete feature requests are welcome.
There is an
Jeff,
I am not sure why you need 100 random numbers for r and K, but if your goal
is to get stochastic state-space model, you need to define the error term
as a separate parameter and run the loop 100 times with the *same* fixed
parameter values. When you do this, then you need to be aware of
Eda,
How many permutations do you use? Have you tried setting the RNG seed via
set.seed() ? Also, if you have borderline p-values that change from run to
run it might indicate not so strong discrimination by the given clustering
of sites.
Cheers,
Peter
--
Péter Sólymos
780-492-8534 |
Attila,
See paper and R code by Millar et al. 2011 for a solution based on 'glm':
http://www.esapubs.org/archive///ecol/E092/146/
Peter
--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
Alberta Biodiversity
Marie,
Your problem and data seems to me a resource selection problem with matched
use-availability design. Estimating procedure for that design is discussed
in Lele and Keim (2006, Ecology 87:3021--3028) and implemented in the
ResourceSelection package: rspf function, see description of argument
-project.org] On Behalf Of Peter Solymos
Sent: Thursday, 28 November 2013 10:33 AM
To: marieline gentes
Cc: r-sig-ecology@r-project.org
Subject: Re: [R-sig-eco] Logistic regression with repeated measures ?
Marie,
Your problem and data seems to me a resource selection problem with
matched use
identical ?
Thank you so much again for your time,
Marie
On Wednesday, November 27, 2013 7:19:47 PM, Peter Solymos
soly...@ualberta.ca wrote:
Chris,
It is not random effect strictly speaking, but something like that. The
problem is this: RSF models are often constructed as mixed models
Hello,
A parametric model (e.g. Clench) would allow both intrapolation and
extrapolation. There are some caveats of course: (1) these models arose in
the temporal accumulation sense, spatial accumulation is usually calculated
for randomized data, which is an assumption that individuals in the
Matias,
The offset term is processed as part of parsing the formula, which results
in a vector of length of the response. Using a vector should not be a
problem.
Peter
--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
soly...@ualberta.ca, Ph 780.492.8534,
was wondering what happens if I
have abundance data for my species matrix but binary trait values?
Because it seems the function has some problems with this combination.
Regards,
Thomas
On 6/12/2013 5:17 PM, Peter Solymos wrote:
Thomas,
1) Presence absence data means that you
Thomas,
1) Presence absence data means that you have cell probabilities 1/S_i for
detections and 0 for missing species in a given community i. As Zoltán also
pointed out, it is meaningful to use this, as it has the interpretation of
choosing different species from a species list (and not from a
Bruce,
Standardizing might not be the best way to go if you have low counts.
You can possibly assume that events follow a homogeneous Poisson
process and rate varies with night length (linear or quadratic) [Y|x ~
Poisson(phi); log(phi)=f(x)]. You can estimate corresponding
coefficients by glm().
Jeffrey,
Check out also the popbio package.
Cheers,
Peter
--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
Alberta Biodiversity Monitoring Institute, http://www.abmi.ca
Boreal Avian Modelling Project,
Maybe:
A$X2[A$X21] - 1
Peter
--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
Alberta Biodiversity Monitoring Institute, http://www.abmi.ca
Boreal Avian Modelling Project, http://www.borealbirds.ca
2012/10/25
Kristen,
Try something like this:
i - sample(1:nrow(DataSet.Sub2), 85, replace=FALSE)
DataSet.Sub2.66- DataSet.Sub2[i,]
DataSet.Sub2.33- DataSet.Sub2[-i,]
Peter
--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
shuffle
the cells a 1000 times, and then go on to make the SSD value 1000 times?
Thanks again for helping out.
Allan
- Original Message -
From: Peter Solymos soly...@ualberta.ca
To: Allan Edelsparre aedel...@uoguelph.ca
Cc: r-sig-ecology@r-project.org
Sent: Saturday, August 18, 2012
Mario,
If you can assume that the waiting time between events is constant
through time, you can model your counts per unit time with Poisson glm
(constant waiting time leads to an exponential survival function).
log(Observation time) can be used as an offset:
glm(interactions~covariate,
Ivailo,
Some (but not all) vegan functions internally coerce the matrix like
input object to matrix using 'x - as.matrix(x)'. The as.matrix()
coercion method is defined for sparse matrices in the Matrix package,
and that is why it works for some (but not all) vegan functions. In
case it does not
Thiago,
It's all about indexing:
rn - union(rownames(matrix1), rownames(matrix2))
cn - union(colnames(matrix1), colnames(matrix2))
x - array(0, dim=c(length(rn), length(cn)), dimnames=list(rn, cn))
x[rownames(matrix1), colnames(matrix1)] - matrix1
x[rownames(matrix2), colnames(matrix2)] -
Hi Elyse,
Tom referred to the mefa package, I'd like to draw the attention to
the mefa4 package which is more efficient and can handle large data
since it uses sparse matrices through the Matrix package. The Melt()
function is the inverse operation to xtabs() or its modified version
Xtabs() in
Kay,
That is an obvious result of the regression tree algorithm which
recursively splits the data and prediction is given as e.g. mean of
observations at terminal nodes. New data will, however, contribute to
cross validation error, a measure of prediction accuracy. The tree
gives the 'global'
Guojun,
Make lists of them with this function:
fun - function(file) {
x - new.env()
load(file, x)
as.list(x)
}
HTH,
Peter
On Fri, Feb 10, 2012 at 1:52 PM, lgj200306 lgj200...@163.com wrote:
Hi, everyone!
I have several R workspaces, with each contains many files. I want to
Cory,
There is a profile method for fisherfit. If that's not enough, you can
have a look inside of fisherfit, and you'll see the Dev.logseries
internal function and how it is used in nlm to get estimate of alpha.
The same function can be used for manual profiling to get likelihood
values for a
On Sat, Aug 6, 2011 at 4:06 AM, Lene Jung ljk...@hotmail.com wrote:
HI,
I’m having several problems trying to fit distributions to data that I have
sorted into a data frame, so the each ID has its own step length and turn
angle.
I can fit a Weibull distribution to step lengths with
Jeff,
The zero truncated Poisson distribution can be described as a
probability function conditional on Y0:
Pr(Y=y|Y0) = Pr(Y=y) / (1-Pr(Y=0)), y=1,2,3,...
This leads to this function 'nll' for the negative log-likelihood:
nll - function(theta, y, X) {
lambda - exp(drop(X %*% theta))
Hi Scott,
Lognormal refers to a probability distribution of a random variable
whose logarithm is normally distributed. Said so, if you log transform
your CV, you can apply Gaussian family, or simply lm().
Cheers,
Peter
On Sat, Mar 26, 2011 at 9:16 AM, Scott Chamberlain
scttchamberla...@gmail.com
Hi,
for one factor, it is enough to do
dat$ageclass - dat$ageclass[drop=TRUE]
the 'purgef' function applies the drop statement for each columns in
the data frame and eventually returns a list because that's how
'lapply' works. If you want a data frame in the end, you can either do
(as I recall
Ophelia and Others,
A more general solution is:
## define a function (that is part of the mefa package)
`rep.data.frame` - function(x, ...)
as.data.frame(lapply(x, rep, ...))
## example from ?mefa:::rep.data.frame
x - data.frame(sample = LETTERS[c(1,1,2,2,3)],
species =
Burak,
Not exactly clear what you want, but Lu et al. 2007 describes the
differentiation coefficient D that is the sum(beta)/sum(gamma) and can
be obtained as attributes(contribdiv(x))$diff.coef . Note also that
there is a link between diversity partitions and distance indices so
you might as well
within them. Does
the beta component of contribdiv ( ) do this, or does it also take into
account the total number of species within the sites?
-Burak
-Original Message-
From: psoly...@gmail.com [mailto:psoly...@gmail.com] On Behalf Of Peter
Solymos
Sent: Wednesday, December 01
On Fri, Sep 3, 2010 at 11:32 PM, Jane Shevtsov jane@gmail.com wrote:
Does R have a p-function for empirical distributions? In other words,
how can I find out what fraction of the values in my data set are
smaller than a given value?
Maybe
sum(x = crit) / length(x)
Cheers,
Peter
Péter
Dear All,
I had a quick look at the internal functions used by pscl::hurdle to
do the numerical optimization by optim. It clearly corresponds to the
hurdle model defined in the paper/vignette, where the zero component
is based on a right censored random variable, that is 0 if the
original count
Hi Kay,
I meant to make permutations within time points, i.e. strata=time, and
not within locations (strate=locations). adonis do F-tests based on
sequential sums of squares from permutations, thus the non
independence of repeated measures can have an effect on p-values
associated with terms
Kay,
using strata (restricting permutations within time points, and not
within locations) in adonis makes some sense, given that permutation
tests assume independence. But that does not solve the problem of
dependence, but it is a good starter. If you have a before-after
control-treatment design,
Kang Min,
The error comes from the function 'fisherfit' that uses 'nlm' to
minimize the negative log likelihood for the Fisher's log-series.
Numerical optimization does not tolerate missing values. This code
reproduces your error:
library(vegan)
data(BCI)
BCI[1,1] - NA
fisher.alpha(BCI)
Dave,
The vegdist function of the vegan package produces an object of class
dist similarly to the dist function in stats. It can be converted
into a symmetric matrix by as.matrix(x). The help page of dist will
give you details about the structure of dist objects.
Cheers,
Peter
On Wed, Apr 7,
Claudia,
Here is a more specific paper with hierarchical Bayesian model:
Stephen L. Rathbun and Songlin Fei
A spatial zero-inflated poisson regression model for oak regeneration
Environmental and Ecological Statistics, 2006, 13: 409-426
Lanna,
I don't know exactly what do you mean by co-occurrence data frame, but
if you'd like to get a species-by-species matrix, in which you count
the co-occurrences of the species (columns in the sites-by-species
community matrix) with each other, you can use the crossprod function
or the %*%
for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-Oorspronkelijk bericht-
Van: Gavin Simpson [mailto:gavin.simp...@ucl.ac.uk]
Verzonden: maandag 8 februari 2010 11:14
Aan: ONKELINX, Thierry
CC: Peter Solymos; Nathan Lemoine
Nathan,
Species richness is categorical, so if your richness values are
usually low (say 20), you should consider the use of Poisson GLM, or
log-transform your response (and log is the canonical link function
for Poisson GLM). This usually improves the model fit. And this might
apply to
I meant Species richness is discrete, not categorical.
Peter
On Sat, Feb 6, 2010 at 12:52 PM, Peter Solymos soly...@ualberta.ca wrote:
Nathan,
Species richness is categorical, so if your richness values are
usually low (say 20), you should consider the use of Poisson GLM, or
log-transform
again for your help.
Etienne
Le 7 janvier 2010 08:17, Peter
Solymos soly...@ualberta.ca a écrit :
Dear Etienne,
You can try the Chris Hennig's prablus package which have a parametric
bootstrap based null-model where clumpedness of occurrences or
abundances
is that matrix
fill
should be kept constant *but also* be constrained within rows.
Thanks
again for your help.
Etienne
Le 7 janvier 2010 08:17, Peter
Solymos soly...@ualberta.ca a écrit :
Dear Etienne,
You can try the Chris Hennig's prablus package which have a parametric
Dear Steve,
If the direction is important, you can use that information as a
separate matrix with signs to scale up its effect. Because distance
can't be negative, you might end up with numbers hard to interpret.
Yours,
Peter
Péter Sólymos
Alberta Biodiversity Monitoring Institute
Department
Christine,
There is no summary method for adonis. After calling the function,
simply use print:
x - adonis(...)
x
And you are right, you can supply raw data and use the method argument
in adonis to define dissimilarity index (which is bray by default).
Cheers,
Peter
Péter Sólymos
Alberta
Hi Bálint,
Here are my two cents.
By using LM with transformed data (which transformation can also be
logit, loglog, cloglog, probit) you loose the Binomial error
structure, because you won't follow the trial/success experiment
scheme. But percent cover is not that kind of [0,1] data where this
Dear Leigh,
You have 2 options:
1. build the MAC OS X package for yourself and install it, in this way
you will be able to use the help files as usual,
2. unpack the .tar.gz and source all files in the /R directory (on how
to do it at once see Example in help(source)).
Cheers,
Peter
On Wed,
Dear Jin-Long,
You can try this:
x - cbind(rnorm(10), rnorm(10), rnorm(10), rnorm(10))
y - cor(x)
y
library(mefa)
z - as.data.frame(as.dist(y))
z
Yours,
Peter
Peter Solymos, PhD
Postdoctoral Fellow
Department of Mathematical and Statistical Sciences
University of Alberta
Edmonton, Alberta
) + SPECIES, x)
## replicates cross tabulated separately
y2 - xtabs(Counts ~ SITE + SPECIES + Replicate, x)
## same with mefa (will give you warnings
## due to some 'empty sample' misspecifications)
m - mefa(stcs(x))
m$segm
Yours,
Peter
Peter Solymos, PhD
Postdoctoral Fellow
Department
Dear Jacob,
Erika was right, you just have to perform a goodness of fit test. Bit
it is easier
to inspect your residual deviance.
It follows a Chi-sqared distribution, where the expected value should
be close to
the degrees of freedom if the fit is good. To get a P value for an
object of class
this (SAMPLES and SPECIES are the two
column in the long format, have to be the same length):
x - mefa(stcs(data.frame(SAMPLES,SPECIES)))
cl - hclust(dist(x$xtab))
Hope this works,
Peter
Peter Solymos, PhD
Department of Mathematical and Statistical Sciences
University of Alberta
Edmonton, Alberta, T6G
58 matches
Mail list logo