Manuel Spínola | 6 Mar 15:00
Picon
Gravatar

Possion model for paired data

Dear list memebers,

Is there a way to do a paired t test but using a poisson model (for counts).
Thank you very much in advance.
Best,

Manuel Spínola

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@...
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Peter Solymos | 6 Mar 17:13
Picon
Picon
Favicon
Gravatar

Re: Possion model for paired data

Hi Manuel,

I would suggest to use the signed difference. This will be Skellam
distribution with expected value mu1-mu2 (means of the two Poisson
distr) and variance mu1+mu2. The skellam and vglm functions in the
VGAM package can be used for a likelihood ratio test for equal means
(see example(skellam)). Please let me know if this works, because I
haven't tried yet.

Péter

Péter

Péter Sólymos, PhD
Postdoctoral Fellow
Department of Mathematical and Statistical Sciences
University of Alberta
Edmonton, Alberta, T6G 2G1
Canada
email <- paste("solymos", "ualberta.ca", sep = "@")

On Fri, Mar 6, 2009 at 7:00 AM, Manuel Spínola <mspinola10 <at> gmail.com> wrote:
> Dear list memebers,
>
> Is there a way to do a paired t test but using a poisson model (for counts).
> Thank you very much in advance.
> Best,
>
> Manuel Spínola
>
(Continue reading)

Kingsford Jones | 7 Mar 22:01
Picon

Re: Possion model for paired data

Hi Manuel,

A couple more options:

i) Look at a density plot or histogram of the pairwise differences --
if they are not wildly skewed and the number of pairs is not very
small then use the normal-theory paired t-test.  Even if the
differences are quite skewed, with greater than say 30 pairs, the mean
difference will be approximately normally distributed (by the Central
Limit Theorem).

ii) You can get paired t-test results using a mixed model.  E.g,

set.seed(777)
tmtA <- rpois(20,4)
tmtB <- tmtA + rpois(20,2)
t.test(tmtB, tmtA, paired=1)

#         Paired t-test
#
# data:  tmtB and tmtA
# t = 7.3461, df = 19, p-value = 5.807e-07
# alternative hypothesis: true difference in means is not equal to 0
# 95 percent confidence interval:
#  1.537427 2.762573
# sample estimates:
# mean of the differences
#                    2.15

dfr <- data.frame(y=c(tmtA,tmtB), tmt=rep(c('A','B'),each=20), pr=rep(1:20,2))
(Continue reading)

Manuel Spínola | 8 Mar 15:46
Picon
Gravatar

2 questions about NMDS in vegan

Dear list members,

I am trying to run an NMDS with 9 standardized variables regarding to 
water quality and I got the following message:

 > aguae.mds <- metaMDS(aguae, dist="euclidean", k=2, zerodist="add")
Using step-across dissimilarities:
Too long or NA distances: 564 out of 666 (84.7%)
Stepping across 666 dissimilarities...
Error in isoMDS(dist, k = k, trace = isotrace) :
 an initial configuration must be supplied with NA/Infs in 'd'
In addition: Warning messages:
1: In metaMDSdist(comm, distance = distance, autotransform = 
autotransform,  :
 Zero dissimilarities changed into 0.0759809585356366
2: In stepacross(dis, trace = trace, ...) :
 Disconnected data: Result will contain NAs
3: In metaMDSdist(comm, distance = distance, autotransform = 
autotransform,  :
 Data are disconnected, results may be meaningless

1) Should I do not standardize the variables?

2) In a plot for a nmds with fitted environmental variables (function 
envfit) how can I change the name of the labels of the vectors (arrows)?

Thank you very much in advance.
Best,

Manuel Spínola
(Continue reading)

zhijie zhang | 8 Mar 15:48
Picon

How to solve it? Y is not only related with the same year's X, but also the previsous few years' X and Y

Dear all,

  Sorry for reposting this question. This mailing list may be more
appropriate.

  Does R have function or method to finish the following task.

Say i have a dataset. The response variable is Y, and the indepedent
variables are X1, X2, X3, and YEAR. See an example.

Y            X1            X2              X3        X4           YEAR

13.4         2.8           3.5              2.5      1.8          1990

10.5        1.8            2.4              2          3           1991

            ....          .....

 In ecology/epidemiology, Y may be not only related with X1, X2, X3 in the
same year as Y, but also may be related with X1, X2, X3 and Y in the
previous one, two or more years as Y. But which year has the closest
relationship is not know and this may be one of the analysis aim.

Take Year=1995 as an example,

 Y_1995 may be related with

      X1_1995 , X2_1995 , X3_1995,

      X1_1994 , X2_1994 , X3_1994, Y_1994,   (previous one year)
(Continue reading)

zhijie zhang | 8 Mar 07:21
Picon

How to solve it? Y is not only related with the same year's X, but also the previsous few years' X and Y

Dear all,
  Sorry for reposting this question. This mailing list may be more
appropriate.
  Does R have function or method to finish the following task.
Say i have a dataset. The response variable is Y, and the indepedent
variables are X1, X2, X3, and YEAR. See an example.
Y              X1            X2            X3          X4            YEAR
13.4         2.8           3.5              2.5      1.8          1990
10.5        1.8            2.4              2          3           1991
            ....          .....
 In ecology/epidemiology, Y may be not only related with X1, X2, X3 in the
same year as Y, but also may be related with X1, X2, X3 and Y in the
previous one , two or more years as Y. But which year has the closest
relationship is not know and this may be one of the analysis aim.
Take Year=1995 as an example,
 Y_1995 may be related with
      X1_1995 , X2_1995 , X3_1995,
      X1_1994 , X2_1994 , X3_1994,  Y_1994,   (previous one year)
     X1_1993 , X2_1993 , X3_1993, Y_1993      (previous two years)
                ...         ...                                    (previous
more years)
  So the possible model seems like Y_1995= (X1_1995 + X2_1995 + X3_1995)
                                                                +(X1_1994 +
X2_1994 + X3_1994 + Y_1994)
                                                                +(X1_1993 +
X2_1993 + X3_1993 + Y_1993)
                                                                +...
  Pay attention to the situation that Y may be not only related with the
same year's X,  but also the previsous few years' X and Y. I had checked out
the methods of time series (TS), but i did not find the right method. I
(Continue reading)

Manuel Spínola | 10 Mar 19:49
Picon
Gravatar

Constrained quadratic ordination in VGAM

Dear list members,

I am running a constrained quadratic ordination (cqo) from package VGAM.  I
contacted the author package, Thomas Yee, regarding to inertia in cqo but he
is not aware of inertia.
Has anybody worked trhough cqo and know how to obtain constrained variance
in the cqo context?
Thank you very much in advance.
Best,

Manuel

	[[alternative HTML version deleted]]
Jari Oksanen | 10 Mar 20:28
Picon
Picon
Favicon

Re: 2 questions about NMDS in vegan

Hello Gavin, Manuel and others,

Thank you for bringing this to our attention. There really seems to be  
a bug in metaMDS: it was geared for handling only typical community  
dissimilarity values (the "recommended" ones) which have maximum value  
of 1 when there is nothing in common between compared units. I'll fix  
that in R-Forge ASAP (the function already is half aware of those open- 
ended dissimilarities with no fixed maximum: it counts correctly the  
number of pairs with no shared species, but it doesn't handle them  
correctly in stepacross). I'll fix this.

Labelling of entries in plot.envfit is indeed a bit trickier, at least  
if we try to do that in the canonical R way, where the labels are  
given as an argument of the plot() command. It would be easier to  
change labels in the envfit but then they would be permanently saved  
with the fitted object. Gavin, if you think this can be done cleanly  
and in an R way, please go on. I don't know yet a snappy solution.

Cheers, jari oksanen
On 10/03/2009, at 21:01 PM, Gavin Simpson wrote:

> On Sun, 2009-03-08 at 08:46 -0600, Manuel Spínola wrote:
>> Dear list members,
>>
>> I am trying to run an NMDS with 9 standardized variables regarding to
>> water quality and I got the following message:
>>
>>> aguae.mds <- metaMDS(aguae, dist="euclidean", k=2, zerodist="add")
>> Using step-across dissimilarities:
>> Too long or NA distances: 564 out of 666 (84.7%)
(Continue reading)

Jari Oksanen | 10 Mar 21:23
Picon
Picon
Favicon

Re: 2 questions about NMDS in vegan

Howdy Folks,

While Gavin and Manuel were watching Liverpool vs. Real Madrid  
football match, I fixed the metaMDS part of the problem. You can get  
the fixed version of metaMDSdist.R from http://r-forge.r-project.org/projects/vegan/ 
  (select the SCM tab and Browse Subversion Repository). Packaged  
versions will be available in a day or two from the same address.

Cheers, Jari Oksanen
Jari Oksanen | 10 Mar 22:10
Picon
Picon
Favicon

Re: 2 questions about NMDS in vegan

Manuel & readers,

I didn't comment on the use of stepacross with Euclidean distances  
earlier, but I do it now: I don't think it makes sense. This is a user  
choice, and technically it now works in the R-Forge version of vegan,  
but I do think that no user should do this (but what am I to stop  
them?). The problem is that the distances among points with nothing in  
common are not necessarily longest Euclidean distances. You may have  
very short Euclidean distances between two sites with no shared  
species if the total abundances in these two sites are low. So the  
stepacross finds the distances across low abundance sites instead of  
really intermediate sites. I do think that you should use stepacross  
only with the usual closed indices with upper limit = 1. If you want  
to use them with open indices (no upper limit, variable values for  
pairs with nothing in common), you should be prepared to research the  
adequacy of your choice.

Setting noshare=0 will turn off automatic stepacross in metaMDS. I  
recommend this be used with Euclidean, Manhattan and other open  
distances, although this is not enforced: the choice is yours.

Cheers, Jari Oksanen

Gmane