Skip to content

Trend() returning incorrect result #9

@M-Harrington

Description

@M-Harrington

In writing the CV procedure I've made extensive use of the trend() method for the STL object created. Unfortunately, it seems like it produces the incorrect result. See for example:

temp<-c(-5.98,-8.15,-5.48,-2.405,-2.17,-5.985,-6.52,-5.06,-4,-6.83,-6.35,-3.63,-4.75,-7.5,-8.75,-7.42,-7.45,-8.09,-7.86,-5.91,-5.79,-8.66,-9.16,-3.575,-3.875,-7.01,-8.5,-8.07,-8.515,-10.3,-8.45,-8.67,-9.16,-9.91,-9.815,-9.12,-12.735,-14.3,-12.77,-4.66,-5.14,-7.25,-8.465,-6.525,-9.46,-11.3,-9.5,-5.86,-6.48,-8.725,-8.53,-6.73,-7.32,-7.3,-7.475,-6.575,-6.77,-7.35,-6.97,-2.85,-5.41,-6.65,-5.92,-5.08,-4.435,-6.525,NA,-5.37,-5.18,-7.575,NA,-3.7,-5.77,-9.355,-9.245,-5.98,-7.87,-9.705,-9.635,-6.795)
start<- c(1996,1); 
temp.ts <- ts(tempdat, start=start, frequency = 4)

stlobj <- stlplus(temp.ts, s.window=55, s.degree=1,
                  t.window=4,
                  t.degree=2,fc.window=10)

plot(temp.ts)
plot(stlobj)
plot(ts(trend(stlobj),start= start,
         frequency = 4))

Trend seems to return something that looks much more like the original time series than the trend line shown in the plot of the stl object. I'm sure this is just a small mistake in the method, but I'm not sure where it might be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions