[R] Unable to compute Confidence Intervals from output from MARSS package
Ashim Kapoor
@@h|mk@poor @end|ng |rom gm@||@com
Wed Jan 23 07:37:45 CET 2019
Dear All,
I am trying to use this package --->
https://cran.r-project.org/web/packages/MARSS/index.html
I am reading this book which shows some examples based on the above package
---> https://nwfsc-timeseries.github.io/atsa-labs/
In a few words, the incantation MARSS(...) estimates the parameters and
MARSSparamCIs should return the confidence intervals. My problem is that
MARSSparamCIs returns this error :-
> MARSSparamCIs(fit)
Error in MARSSharveyobsFI(MLEobj) : replacement has length zero
>
### This page and the next page, explains the jargon used :
https://nwfsc-timeseries.github.io/atsa-labs/sec-dlm-example-of-a-univariate-dlm.html
### Here is a MWE to recreate the error :-
# This is a Time Varying Parameters regression
# Here a is fixed and b is doing a RW.
x1 <- rnorm(1000)
b <- cumsum(rnorm(1000, sd = sqrt(.6)))
y <- 1 + b*x1 + rnorm(1000)
Z = array(NA,c(1,2,1000))
Z[1,1,] = rep(1,1000)
Z[1,2,] = x1
mod2.list = list ( B = matrix(c(1,0,0,1),nrow = 2 , byrow = T), U =
matrix(0,2,1),
Q = matrix(list(0,0,0,"s2b"),2,2), Z= Z, A = matrix(0), R = matrix("r"))
fit = MARSS(as.vector(y), model = mod2.list,inits =
list(x0=matrix(0,nrow=2,ncol=1)))
MARSSparamsCIs(fit)
# The above will give this error :
Error in MARSSharveyobsFI(MLEobj) : replacement has length zero
Best Regards,
Ashim
[[alternative HTML version deleted]]
More information about the R-help
mailing list