+ Reply to Thread
Results 1 to 3 of 3

Thread: trend line

  1. #1
    Super Moderator
    Points: 14,638, Level: 78
    Level completed: 47%, Points required for next Level: 212
    bugman's Avatar
    Posts
    1,493
    Thanks
    90
    Thanked 140 Times in 109 Posts

    trend line



    Hello,

    this is probably a very straight forward question to do with plotting:

    I have boxplots representing turbidity from each of 5 rainfall catergories from a particular station. Each boxplot represents 4 years worth of data. (x axis = catergory; y-axis=total rainfall).

    I was wondering if its possible to:

    a) plot a median trend line (there is a clear positive trend)
    b) can I also plot lines for percentiles (i.e 25th and 75th)?

    Thanks in adance for any help.

  2. #2
    R purist
    Points: 13,440, Level: 75
    Level completed: 48%, Points required for next Level: 210
    TheEcologist's Avatar
    Location
    The Netherlands.
    Posts
    1,287
    Thanks
    113
    Thanked 251 Times in 127 Posts
    Quote Originally Posted by bugman View Post
    Hello,

    this is probably a very straight forward question to do with plotting:

    I have boxplots representing turbidity from each of 5 rainfall catergories from a particular station. Each boxplot represents 4 years worth of data. (x axis = catergory; y-axis=total rainfall).

    I was wondering if its possible to:

    a) plot a median trend line (there is a clear positive trend)
    b) can I also plot lines for percentiles (i.e 25th and 75th)?

    Thanks in adance for any help.
    Short answer: yes.
    #for a) in R plot your boxplots and then type:
    cat=1:5
    lines(cat,tapply(y,x,median,na.rm=T))
    #or use a fit model
    abline(lm(tapply(y,x,median,na.rm=T)~cat))

    #for B) see ?quantile, from the top of my head it should be something like this
    percen=0.25
    lines(cat,tapply(y,x,quantile, prob=percen))
    percen=0.75
    lines(cat,tapply(y,x,quantile, prob=percen))
    The true ideals of great philosophies always seem to get lost somewhere along the road..

  3. #3
    Super Moderator
    Points: 14,638, Level: 78
    Level completed: 47%, Points required for next Level: 212
    bugman's Avatar
    Posts
    1,493
    Thanks
    90
    Thanked 140 Times in 109 Posts

    Thumbs up


    many thanks!!!

+ Reply to Thread

Similar Threads

  1. Meaning of Logarithmic Trend Line
    By skohon in forum Regression Analysis
    Replies: 0
    Last Post: 10-13-2010, 10:45 AM
  2. Estimating a trend line
    By cmf0106 in forum Statistics
    Replies: 0
    Last Post: 09-14-2009, 07:54 AM
  3. Error calculation for best fit line
    By chris251 in forum Statistics
    Replies: 0
    Last Post: 11-16-2008, 07:29 AM
  4. line 1:1 test
    By Shui in forum Statistics
    Replies: 0
    Last Post: 09-17-2007, 03:16 AM
  5. On-line Statistics Course
    By Bound in forum Education and Career
    Replies: 0
    Last Post: 11-16-2006, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats