Dear List
The UKgas data is stored as an object of class 'ts'. I am trying to use UKgas
in a formula as argument to a function. However, I do not know how to access
the 'time series' information in the response (such as start() end() etc.).
Here is a boiled down example.
ssm -
The problem here is that you called model.frame() with (I presume, the
'factory-fresh' default) na.action=na.omit, and model.frame is documented
to remove tsp attributes in that case.
Use model.frame(..., na.action = NULL), e.g.
model.frame(~UKgas, na.action=NULL)[[1]]
is a time
You might want to look at the dyn package. It allows
time series in model formulae, e.g. this aligns UKgas
and diff(UKgas) properly:
dyn$lm(UKgas ~ diff(UKgas))
dyn$ transforms the above to
dyn(lm(dyn(UKgas ~ diff(UKgas
and the inner dyn adds class dyn to the formula's class vector