Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Plotting smoothed tide charts with -twoway-

    Hello, I am seeking to create a twoway graph of date/time vs. tide height, in which the data points are connected by a smooth "roller-coaster" line. Is this possible?
    The data structure is:

    HTML Code:
        day    ht                 date  
        Thu   2.2   01jan2015 01:43:00  
        Thu   6.5   01jan2015 08:15:00  
        Thu   -.3   01jan2015 15:08:00  
        Thu   4.7   01jan2015 22:03:00  
        Fri   2.4   02jan2015 02:38:00  
        Fri   6.5   02jan2015 08:59:00  
        Fri   -.6   02jan2015 15:52:00  
        Fri   4.9   02jan2015 22:54:00  
        Sat   2.5   03jan2015 03:28:00  
        Sat   6.5   03jan2015 09:41:00  
        Sat   -.7   03jan2015 16:32:00
    Commands I've used are:
    HTML Code:
    twoway connected ht date
    , which creates a jagged line, and
    HTML Code:
    twoway lowess ht date
    or
    HTML Code:
    twoway lpoly ht date
    both create a statistical conversion that no longer displays the diurnal tide variations day by day. I believe what I need is a command that would interpolate between the x/y data coordinates, but not sure how to tackle that.



  • #2
    Using your 11 observations of sample data, I got a plot that might look like what I imagine you're looking for with
    Code:
    twoway mspline ht date, bands(11)
    In this example, I told Stata to nail each data point exactly (hence the same number of bands as observations) and connect them with a cubic spline.

    Click image for larger version

Name:	Graph.png
Views:	2
Size:	107.2 KB
ID:	1307322

    I am assuming that your interest lies in producing an illustrative plot. If you are intrerested in statistical analysis of your data, you should perhaps be looking into capabilities described in Stata's [TS] Time-Series Reference Manual.
    Attached Files

    Comment

    Working...
    X