I am trying to analyze a time series data using the MS model with R.

I wrote the following codes and then got an error at the last line:

tsdata <- read.table("tsdata.txt", header=TRUE, skip= 1)
topix <- ts(tsdata$topix, start=c(1975,1), frequency=12)
plot(topix,type = "l", xlab="year", main="TOPIX")
levelmod <- lm(topixrate~1)
levelswmod = msmFit(levelmod, k=2, sw=c(T,T), p=0)

Error in (function (classes, fdef, mtable) : 
  unable to find an inherited method for function ‘msmFit’ for signature 
  ‘"lm", "numeric", "integer", "numeric", "missing", "missing"’

Please show me how to solve this problem.

Thank you for your help in advance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.