I am still having a problem with my coercing my data frame (tkr) into a time 
series using ts  to use the stl function.
   
  When I read the data into R and do dim tkr the result is 132 1, when I type 
class I get (data.frame).
   
  I have tried several methods so far to to coerce it into a a time series and 
use the stl function,( see thread) .
   
  A suggestion was to  use the following:
   
  tstkr <- ts(as.numeric(tkr), deltat=1/12)
   
  before using the stl function, however I now get this error message:
   
  Error in as.double.default(tkr) : (list) object cannot be coerced to 'double'
   
  I don't know what this means....does anybody have any other ideas...? Hope I 
have put enough information on here for people to be able to help..if not let 
me know, also if anyone wants to send me to email them my data then I am happy 
to do so..
   
  Thanks to everyone who has tried to help so far much appreciated...

Spencer Graves <[EMAIL PROTECTED]> wrote:
  The 'ts' function retains the 'dim' attribute of 'tkr'. When 'stl' 
finds this 'dim' attribute, it thinks 'tstkr' is a multivariate time 
series. This causes it to stop with the error, "only univariate series 
allowed".

Consider the following modification of an example from the 'stl' help 
file:

> not.1 <- stl(nottem, "per")
> Nottem <- ts(array(nottem, dim=c(240, 1)))
> Not.1 <- stl(Nottem)
Error in stl(Nottem) : only univariate series are allowed

Solution:

tstkr <- ts(as.numeric(tkr), deltat=1/12)

After converting tkr and tstkr from a matrix to a vector like this, 
please try 'stl(tstkr)'. If it doesn't work, please submit another post.

Hope this helps.
Spencer Graves
p.s. Your example was not quite self-contained, because I didn't know 
for sure the format, class, and attributes of your 'tkr' object. The 
absence of these details made it harder for me (and, I believe, anyone 
else) to reply. You might get better replies quicker with greater 
attention to such details.

Daniel sutcliffe wrote:
> Hi
> 
> I am still having problems with using the stl 
function, when I read the csv file into R into a
file called tkr and use dim(tkr) the result is 132 x 1
which is fine.
> 
> When coerce it into a trime series using ts either:
> 
> 
> tstkr <- ts(t(tkr), deltat=1/12) or
> 
> tstkr <- ts(c(tkr), deltat=1/12) 
> 
> and use the stl function I get the following error:
> 
> Error in stl(tstkr) : only univariate series are allowed
> 
> id just use the tkr file I get the same error..does anyibe have an idea what 
> to do next, here is my data...it's not sensitive so if anyone wants to try 
> then you are very welcome!
> Rate 184.0222 180.517 222.5792 173.5066 192.7852 198.0429 182.2696 189.28 
> 178.7644 206.8059 236.6 155.9807 231.7314 249.2868 222.9537 198.3761 201.8872 
> 208.9094 242.2646 221.1982 228.2203 245.7757 244.0202 194.865 239.3664 
> 234.0862 251.6867 235.8463 197.1253 237.6063 267.5271 228.8061 241.1264 
> 249.9267 256.9669 188.325 258.8788 239.5069 214.8518 234.2237 211.3296 
> 234.2237 237.7458 156.7361 239.5069 225.4183 257.1177 170.8248 230.1611 
> 265.3001 296.9253 193.265 233.675 240.7028 249.4876 205.5637 237.1889 
> 237.1889 289.8975 245.9736 283.1755 316.3875 372.3234 234.2316 263.9476 
> 314.6395 286.6715 272.6875 323.3795 295.4115 300.6555 174.7997 227.184 
> 277.4767 317.364 234.121 286.1478 279.2109 280.9452 235.8552 319.0982 
> 296.5532 303.4901 173.4229 302.6072 312.8651 389.7991 223.9635 254.7371 
> 329.9615 288.93 317.994 312.8651 381.2509 333.3808 194.8996 285.5743 304.0526 
> 335.9698 307.4123 346.0489 288.934 335.9698 243.5781 384.6854 359.4876 
> 357.8078 221.74 336.3712 344.6562 389.3952 286.6611 338.0282 407.6222 
> 356.2552 241.9221 347.9702 400.9942 381.1102 304.8882 383.9077 418.5089 
> 476.1774 331.1822 378.9647 375.6694 339.4206 364.1357 420.1565 446.5193 
> 410.2705 296.5811
> 
> Cheers and thanks to everyone who offered suggestions before.
> 
> Daniel
> 
> 
> 
> 
> 
> SAULEAU Erik-André wrote:
> Perhaps ts(t(tkr))?
> 
>> -----Message d'origine-----
>> De : Daniel sutcliffe [mailto:[EMAIL PROTECTED] 
>> Envoyé : mercredi 12 juillet 2006 15:53
>> À : [email protected]
>> Objet : [R] ts and stl functions
>>
>>
>> Hi, 
>>
>> I have imported a csv file into R which contains one column 
>> (the rate er 100,000 population of a disease, by month over 
>> 11 years) I coerced into a time series using the following function, 
>>
>> tstkr<-ts(tkr,deltat=1/12) 
>>
>> This seems to work fine, and when I check for the class of 
>> the object using class(tstkr) I get "ts" as the response. 
>>
>> When I try to use the stl function in stats I get the error message: 
>>
>> Error in stl(tstkr)only univariate series are allowed 
>>
>> I then tried this: 
>>
>> tstkr <- ts(c(tkr), deltat=1/12) 
>>
>> however this made no difference...I still get an error - does 
>> anybody know what is wrong? 
>>
>> Regards, 
>>
>> Daniel 
>>
>>
>> ---------------------------------
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [email protected] mailing list 
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read 
>> the posting guide! http://www.R-project.org/posting-guide.html
>>
>>
>> **************************************************************
>> ********************
>> Afin d'eviter toute propagation de virus informatique, et en 
>> complement 
>> des dispositifs en place, ce message (et ses pieces jointes 
>> s'il y en a) 
>> a ete automatiquement analyse par un antivirus de messagerie. 
>> **************************************************************
>> ********************
>>
> 
> 
> **********************************************************************************
> Afin d'eviter toute propagation de virus informatique, et en complement 
> des dispositifs en place, ce message (et ses pieces jointes s'il y en a) 
> a ete automatiquement analyse par un antivirus de messagerie. 
> **********************************************************************************
> 
> 
> 
> 
> ---------------------------------
> 
> [[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


                
---------------------------------

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to