Emily Benson | 3 Nov 00:42
Picon

Plot a polynomial regression

Hi,
For these data, my independent variable is river discharge (Discharge) and
my dependent variable is an estimate of gross primary production (GPP). I
have fitted a polynomial regression to my data using the following command:
> model<-lm(GPP ~ poly(Discharge, 2), data=nighttimeds1.dat)
I can produce a scatterplot of the data using the following commands:
> # Make a plot with Discharge on the x-axis and GPP on the y-axis;
> library(lattice)
> xyplot((GPP)~(Discharge), groups=Site, data=nighttimeds1.dat,
+ col=c("red","blue","green","yellow"), type="p")
What I would like to do is include the polynomial regression curve on the
scatterplot of the data, but I cannot figure out how to do this.
Can anyone help me?
Thank you,
Emily

	[[alternative HTML version deleted]]
Corrado | 3 Nov 13:36
Picon
Favicon

Testing "order" on predicted data

Dear all,

I have a strange situation:

1) I have some data that are associated with "sites"
2) I have two models that predict the data on the "sites"
3) I would like to understand which of the models predicts the order of the 
data better. In other words, I am not interested in the models predicting the 
values exactly, but only in predicting values that are in the same order 
(smaller to bigger).

What is the best test?

PS: Does that make sense?

Best,
--

-- 
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529@...
Giovanni Petris | 3 Nov 15:20
Picon
Favicon

Re: Plot a polynomial regression


See

?predict

HTH,
Giovanni

> Date: Mon, 02 Nov 2009 15:42:53 -0800
> From: Emily Benson <erbenson1@...>
> Sender: r-sig-ecology-bounces@...
> Precedence: list
> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
> DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
> 
> Hi,
> For these data, my independent variable is river discharge (Discharge) and
> my dependent variable is an estimate of gross primary production (GPP). I
> have fitted a polynomial regression to my data using the following command:
> > model<-lm(GPP ~ poly(Discharge, 2), data=nighttimeds1.dat)
> I can produce a scatterplot of the data using the following commands:
> > # Make a plot with Discharge on the x-axis and GPP on the y-axis;
> > library(lattice)
> > xyplot((GPP)~(Discharge), groups=Site, data=nighttimeds1.dat,
> + col=c("red","blue","green","yellow"), type="p")
> What I would like to do is include the polynomial regression curve on the
> scatterplot of the data, but I cannot figure out how to do this.
> Can anyone help me?
> Thank you,
> Emily
(Continue reading)

Sarah Goslee | 3 Nov 16:36
Picon

Re: Testing "order" on predicted data

You really don't give enough information - what's "better"? Are you
looking for linear relationships? Single variables or many?

Without knowing anything else, I think you might try looking at
Spearman (rank) correlations.

Sarah

On Tue, Nov 3, 2009 at 7:36 AM, Corrado <ct529@...> wrote:
> Dear all,
>
> I have a strange situation:
>
> 1) I have some data that are associated with "sites"
> 2) I have two models that predict the data on the "sites"
> 3) I would like to understand which of the models predicts the order of the
> data better. In other words, I am not interested in the models predicting the
> values exactly, but only in predicting values that are in the same order
> (smaller to bigger).
>
> What is the best test?
>
> PS: Does that make sense?
>
> Best,
> --
> Corrado Topi

--

-- 
Sarah Goslee
(Continue reading)

Corrado | 3 Nov 16:40
Picon
Favicon

Re: Testing "order" on predicted data

Dear friends,

the data are ordered real numbers between 0 and 1. something of that sort:

		observations
site4	0.3
site1	0.4
site5	0.42
.
.
.
siten	0.999

after being sorted. I would like the models to order the sites in the same 
order, even if the values are not right.

That is ideally:

		model1
site4	2.4
site1	2.8
site5	4.0
.
.
.
siten	32

As you see, the values are different, but the order is still the same, that is 
if I sort the values, I still get the same sorting order.

(Continue reading)

Aitor Gastón | 3 Nov 16:57
Picon
Picon

Re: Testing "order" on predicted data

As your observed data are not binary AUC (operating characteristic curve 
area) won't work properly.

Any rank correlation coefficient may be useful, check the example, if 
predictions order the sites as the observations the correlation (rho) is 1. 
Changing the last two predictions causes a reduction of rho (0.8 in the 
example).

observed<-c(0.3,0.4,0.42,0.99)
predicted1<-c(2.4,2.8,4.0,32)
predicted2<-c(2.4,2.8,32,4.0)

rho1<-cor(observed,predicted1,method = "spearman")
rho2<-cor(observed,predicted2,method = "spearman")
rho1
rho2

Aitor

----- Original Message ----- 
From: "Corrado" <ct529@...>
To: <r-sig-ecology@...>
Sent: Tuesday, November 03, 2009 4:40 PM
Subject: Re: [R-sig-eco] Testing "order" on predicted data

> Dear friends,
>
> the data are ordered real numbers between 0 and 1. something of that sort:
>
> observations
(Continue reading)

Nicholas Lewin-Koh | 3 Nov 17:32
Favicon

RE: Plot a polynomial regression

Hi,
Doing that with xyplot is a bit of a PITA, but
try:
fits<-fitted(model)
xyplot((GPP)~(Discharge), groups=Site, data=nighttimeds1.dat, fits=fits,
       panel=function(x,y,fits,...){
             panel.xyplot(x,y,...)
             panel.lines(x,fits)
        },col=c("red","blue","green","yellow"), type="p")

by the way, polynomials may have some properties that maybe undesirable
in your 
model. Try 
library(splines)
model<-lm(GPP ~ poly(Discharge, 2), data=nighttimeds1.dat)
model2<-lm(GPP ~ ns(Discharge, k=3), data=nighttimeds1.dat)
anova(model, model2) ## likelihood ratio test

Nicholas

> Message: 1
> Date: Mon, 2 Nov 2009 15:42:53 -0800
> From: Emily Benson <erbenson1@...>
> Subject: [R-sig-eco] Plot a polynomial regression
> To: r-sig-ecology@...
> Message-ID:
> 	<91cdc84e0911021542o421a6e80h7613423a198efb2c@...>
> Content-Type: text/plain
> 
> Hi,
(Continue reading)

David G. Armanini | 3 Nov 19:38
Picon

SIMPROF test

Hi all,

do you know if is available in R a code to perform the 'similarity profile'
(SIMPROF) test? At the moment it is implemented in PRIMER package (v6, K.R.
Clarke and R.N. Gorley, PRIMER v6: User Manual/Tutorial. PRIMER-E, Plymouth
(2006). 

The manual describes it as:

"Tests for structure in the data. First a resemblance profile is determined
by ranking the resemblance matrix for the data. A mean profile is then
calculated by randomising the order of each variables values and
re-calculating the profile. The pi statistic is calculated as the deviation
of the actual data profile with the mean one. This is compared with the
deviations of further randomly generated profiles to test for significance.
(Null hypothesis is no structure so randomisation allowed)"

A more detailed description is provided here: 

CLARKE KR, SOMERFIELD PJ, GORLEY RN (2008) Exploratory null hypothesis
testing for community data: similarity profiles and biota-environment
linkage. J Exp Mar Biol Ecol 366, 56-69 

I appreciate suggestions of comparable methods as well,

thanks in advance,

regards

David Armanini
(Continue reading)

Corrado | 4 Nov 17:21
Picon
Favicon

Re: Testing "order" on predicted data

Dear Sarah,

I do not understand the question. 

I am not looking for any relationships between data, only rank order 
correspondence, which means the nearer is the rank order equivalence the 
better it is. I have tried to explain in my 2 emails, probably failing. The 
number of variables is normally one, as in my second email.

I considered Kendal and Wilcoxon (and also Friedman), but I am not sure which 
one is better (that is better at comparing rank orders).

Another example, to simplify the question: if you have ten judges evaluating 
the quality of 10 products by ranking from the best (1) to the worst (10) and 
you want to discover which couple of judges did provide the most similar 
ranking for the products, which test would you use?

Best,

On Tuesday 03 November 2009 15:36:59 Sarah Goslee wrote:
> You really don't give enough information - what's "better"? Are you
> looking for linear relationships? Single variables or many?
> 
> Without knowing anything else, I think you might try looking at
> Spearman (rank) correlations.
> 
> Sarah
> 
> On Tue, Nov 3, 2009 at 7:36 AM, Corrado <ct529@...> wrote:
> > Dear all,
(Continue reading)

Enrico Barbone | 5 Nov 12:31
Picon

V-ratio in bipartite

Dear all
I am using the r package bipartite to calculate c-scores and v-ratios of incidence matrices. checking the
results agains Gotelli's Ecosim output, I have foung considerable discrepancies regarding v-ratios. I
cannot figure out where the problem is, as I have run both packages using very simple 4x4 incidence
matrices, calculating v-ratios by hand using schluter 1984, and veryfing that, while ecosim results
matched mine, bipartite provided unpredictable values. 
Is there some kind of normalization, as for the c-score?
thank you so much for your kind help.

Enrico Barbone PhD
University of Salento
Di.S.Te.B.A.; Ecology laboratory
Centro Ecotekne - S.P. Lecce Monteroni, 73100 Lecce - ITALY
Work Phone: +39.0832.298600; Cell: +39.349.5097805

	[[alternative HTML version deleted]]

Gmane