Zongshan Li | 1 Jan 12:22
Picon
Favicon

How to standardize data to a fixed range, such as [-1, 1]?

Dear the friends of R-Ecology: 
     I am a beginner for R language, and I think this problem might be some kind of
stupid one.
 ---------------------
   My question is tostandardize the vectors of some dataset into the same range(such as[-1,1]), so
as to plot these vectors into same X_Y axes and compare their fluctuations easily. 
 ---------------------
   I try to use the functions: dnorm, pnorm, qnorm, but have the wrong results. 
   I try to apropos("norm") and found no related function specific for standardizing data.
 
 
Any help is strongly appreciated,
thank you in advance,
 
----------------------
Zongshan, Li 
2010-01-01Research Center for Eco-Environmental Sciences,Chinese Academy of Sciences
Shuangqing Road, Haidian street, Beijing, 100085
Tel: 86-10-13699145748
QQ: 1141958023
email: ZongShan_Li@...
website: http://www.rcees.ac.cn/  

      
	[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
(Continue reading)

Zongshan Li | 1 Jan 12:49
Picon
Favicon

How to create axes in arbitrary positions?

Dear the friends of R-Ecology: 
     I am a beginner for R language, and I think my problem may be very simple.
   --------------------
   Prior to use R, I used matlab to draw several plots of different heights into one object. 
   The codes are that: 
      axes('position', [0.1,0.1,0.4,0.1]); plot……
      axes('position', [0.1,0.2,0.4,0.2]); plot…….
      axes('position', [0.1,0.4,0.4,0.3]); plot…….
   I am wondering if there is some kind of function in R to draw plots at the specified locations?
  ---------------------------  
     
    Note: the following is the helping information of the function: axes.  
 
   AXES   Create axes in arbitrary positions.
    AXES('position', RECT) opens up an axis at the specified location
    and returns a handle to it.
    RECT = [left, bottom, width, height] specifies the location and
    size of the side of the axis box, relative to the lower-left
    corner of the Figure window, in normalized units where (0,0)
    is the lower-left corner and (1.0,1.0) is the upper-right.
 
  
 
Any help is strongly appreciated,
thank you in advance,
 
----------------------
Zongshan, Li 
2010-01-01
Research Center for Eco-Environmental Sciences,Chinese Academy of Sciences
(Continue reading)

Will Morris | 1 Jan 13:54
Picon

Re: How to standardize data to a fixed range, such as [-1, 1]?

Also see the function "decostand" in the "vegan" package.

Will Morris
Masters of Philosophy candidate
Vesk Plant Ecology Lab
The School of Botany
The University of Melbourne
Australia
Phone: +61 3 8344 0120
http://www.botany.unimelb.edu.au/vesk/

On 01/01/2010, at 22:22, Zongshan Li <zongshan_li@...> wrote:

> Dear the friends of R-Ecology:
>      I am a beginner for R language, and I think this problem might
> be some kind of stupid one.
>  ---------------------
>    My question is tostandardize the vectors of some dataset into the
> same range(such as[-1,1]), so as to plot these vectors into same X_Y
> axes and compare their fluctuations easily.
>  ---------------------
>    I try to use the functions: dnorm, pnorm, qnorm, but have the
> wrong results.
>    I try to apropos("norm") and found no related function specific
> for standardizing data.
>
>
> Any help is strongly appreciated,
> thank you in advance,
>
(Continue reading)

Will Morris | 1 Jan 13:52
Picon

Re: How to standardize data to a fixed range, such as [-1, 1]?

How bout,

If you data is x...

(((x - min(x))/max(x))*2)-1

Will Morris
Masters of Philosophy candidate
Vesk Plant Ecology Lab
The School of Botany
The University of Melbourne
Australia
Phone: +61 3 8344 0120
http://www.botany.unimelb.edu.au/vesk/

On 01/01/2010, at 22:22, Zongshan Li <zongshan_li@...> wrote:

> Dear the friends of R-Ecology:
>      I am a beginner for R language, and I think this problem might
> be some kind of stupid one.
>  ---------------------
>    My question is tostandardize the vectors of some dataset into the
> same range(such as[-1,1]), so as to plot these vectors into same X_Y
> axes and compare their fluctuations easily.
>  ---------------------
>    I try to use the functions: dnorm, pnorm, qnorm, but have the
> wrong results.
>    I try to apropos("norm") and found no related function specific
> for standardizing data.
>
(Continue reading)

Sarah Goslee | 1 Jan 14:22
Picon

Re: How to create axes in arbitrary positions?

I'm not familiar with matlab - you are more likely to get good answers if you
can explain your question clearly, and without referring to software other
than R.

That said, you might want to look at ?layout or ?axis and ?par

Sarah

On Fri, Jan 1, 2010 at 6:49 AM, Zongshan Li <zongshan_li@...> wrote:
> Dear the friends of R-Ecology:
>      I am a beginner for R language, and I think my problem may be very simple.
>    --------------------
>    Prior to use R, I used matlab to draw several plots of different heights into one object.
>    The codes are that:
>       axes('position', [0.1,0.1,0.4,0.1]); plot……
>       axes('position', [0.1,0.2,0.4,0.2]); plot…….
>       axes('position', [0.1,0.4,0.4,0.3]); plot…….
>    I am wondering if there is some kind of function in R to draw plots at the specified locations?
>   ---------------------------
>
>     Note: the following is the helping information of the function: axes.
>
>    AXES   Create axes in arbitrary positions.
>     AXES('position', RECT) opens up an axis at the specified location
>     and returns a handle to it.
>     RECT = [left, bottom, width, height] specifies the location and
>     size of the side of the axis box, relative to the lower-left
>     corner of the Figure window, in normalized units where (0,0)
>     is the lower-left corner and (1.0,1.0) is the upper-right.
>
(Continue reading)

LisaB | 1 Jan 22:44
Picon

Time series and GLS


Hello -

I need to analyze some time series data in an ANOVA framework, but am unsure
of how to go about it.  I have data on nest success (response) over a 22
year period for two populations.  For each year I have one value of nest
success per population.  I am interested in determining 1) whether there are
differences in nest success over time between these two populations and 2)
what are the trends for each population over time.  My thought is to use GLS
and model temporal autocorrelation if the acf function indicates this is an
issue, but since population is a categorical variable I'm unsure if this is
appropriate.  Any advice would be much appreciated. Thank you. Lisa

   
--

-- 
View this message in context: http://n2.nabble.com/Time-series-and-GLS-tp4240700p4240700.html
Sent from the r-sig-ecology mailing list archive at Nabble.com.
Kingsford Jones | 2 Jan 18:55
Picon

Re: Time series and GLS

The gls function in nlme fits a general linear model, so yes you can
have categorical predictors (the advantage over the lm function is the
error covariance matrix may have non-zero off-diagonals, such as with
an autocorrelation structure, and non-constant diagonals).

hth,
Kingsford Jones

On Fri, Jan 1, 2010 at 2:44 PM, LisaB <lisabaril@...> wrote:
>
> Hello -
>
> I need to analyze some time series data in an ANOVA framework, but am unsure
> of how to go about it.  I have data on nest success (response) over a 22
> year period for two populations.  For each year I have one value of nest
> success per population.  I am interested in determining 1) whether there are
> differences in nest success over time between these two populations and 2)
> what are the trends for each population over time.  My thought is to use GLS
> and model temporal autocorrelation if the acf function indicates this is an
> issue, but since population is a categorical variable I'm unsure if this is
> appropriate.  Any advice would be much appreciated. Thank you. Lisa
>
>
>
>
> --
> View this message in context: http://n2.nabble.com/Time-series-and-GLS-tp4240700p4240700.html
> Sent from the r-sig-ecology mailing list archive at Nabble.com.
>
> _______________________________________________
(Continue reading)

LisaB | 2 Jan 23:34
Picon

Re: Time series and GLS


Thanks Kinsford.  I thought it would be appropriate.  As a follow up
question: My first thought is to set up the data file with three columns:
year, population (A,B), and nest success and then to input the following
formula: success.gls=gls(success~year*population).  This would allow me to
test for the effect of year for each population and then also test for
differences between the two populations.  My questions are 1) have I
specified the model right for those questions and 2) would the acf function
calculate the autocorrelation correctly even though my 'year' in the data
file is repeated twice (once for each value of nest success/population)? 
Thanks. Lisa (hope all is well with you)

Kingsford Jones wrote:
> 
> The gls function in nlme fits a general linear model, so yes you can
> have categorical predictors (the advantage over the lm function is the
> error covariance matrix may have non-zero off-diagonals, such as with
> an autocorrelation structure, and non-constant diagonals).
> 
> hth,
> Kingsford Jones
> 
> On Fri, Jan 1, 2010 at 2:44 PM, LisaB <lisabaril <at> hotmail.com> wrote:
>>
>> Hello -
>>
>> I need to analyze some time series data in an ANOVA framework, but am
>> unsure
>> of how to go about it.  I have data on nest success (response) over a 22
>> year period for two populations.  For each year I have one value of nest
(Continue reading)

Kingsford Jones | 3 Jan 09:39
Picon

Re: Time series and GLS

On Sat, Jan 2, 2010 at 3:34 PM, LisaB <lisabaril@...> wrote:
>
> Thanks Kinsford.  I thought it would be appropriate.  As a follow up
> question: My first thought is to set up the data file with three columns:
> year, population (A,B), and nest success and then to input the following
> formula: success.gls=gls(success~year*population).  This would allow me to
> test for the effect of year for each population and then also test for
> differences between the two populations.  My questions are 1) have I
> specified the model right for those questions and 2) would the acf function
> calculate the autocorrelation correctly even though my 'year' in the data
> file is repeated twice (once for each value of nest success/population)?
> Thanks. Lisa (hope all is well with you)

Hi Lisa -- I didn't realize that was you in the first email -- all is
well, thanks.

To answer your first question, assuming normality and linearity I
would say that success ~ year*population is indeed a good place to
start.  The right-hand side expands to 1 + year + population
+year:population, and those 4 terms respectively will produce
estimates of the baseline (probably level A) intercept, baseline
slope, adjustment of that line up or down for population B, and
adjustment of the slope of the line for population B. So, for example,
for population B the predicted increase in mean success for a one unit
increase in year would come from the sum of the beta-hats from the 2nd
and 4th terms.  Checking for population effects could be an LRT
between models with and without the last two terms.

To answer the second question, you would be interested in modeling
autocorrelation within each of the two trajectories.  So if for
(Continue reading)

Scott Foster | 3 Jan 10:07
Picon
Picon

Re: Time series and GLS

Hi,

Just a few quick thoughts.

*) your success.gls model contains a linear effect for year.  Is this 
really likely over the time period you mention?  I would highly doubt it 
(but this is really just a guess).  If this is not the case then your 
residuals are likely to show falsely high autocorrelation, not because 
it is there but because the residuals come from an inappropriate mean model.
*) With the previous point in mind: have you considered using GAM 
models?  It seems like a perfect application as you can specify 
different smooth functions for each of the populations and then see if 
they really are all that different (through LRTs).
*) The GLS function will assume normality (albeit correlated).  Is this 
really all that believable?  In the GAM framework you could specify 
binomial data, an assumption that is much more likely to make sense.  Of 
course, your data may contain enough nests sampled and a favourable 
probability of success, to make the normality assumption very plausible.
*) The GAM model, when viewed as a random effects model, does specify a 
correlation structure amongst the outcomes.  It may not be the most 
appropriate correlation structure, nor even *an* appropriate structure 
but it may be a suitable starting place.  Most analysts would consider 
it a useful finishing place too (but you can extend the GAM model -- 
Richard Morton has done some work in this line although I can't find the 
reference right now). 

Be careful taking acf of residuals in GAM models -- the residuals from 
the model conditional on the random effects may not tell much about the 
correlation structure (need the marginal distribution for this).

(Continue reading)


Gmane