[prev in list] [next in list] [prev in thread] [next in thread]
List: r-help
Subject: [R] "dlm" Package: Calculating State Confidence Intervals
From: "Elmously, Ziad (TSHHM)" <ziad.elmously () kantar ! com>
Date: 2018-03-28 13:55:43
Message-ID: VI1PR01MB10886F24BB7EE257E13E8A2796A30 () VI1PR01MB1088 ! eurprd01 ! prod ! exchangelabs ! com
[Download RAW message or body]
To Whom It May Concern,
I estimated a model with 6 states (3 time-varying Regression parameters and 3 \
quarterly seasonality trends). The model is saved in the object titled "mod."
Following the example in the documentation and using the commands below, I am \
attempting to use the function "dlmSvd2var" to implement SVD and calculate the 90% \
confidence errors for each time-varying state.
outF <- dlmFilter(y,mod)
v <- unlist(dlmSvd2var(outF$U.C, outF$D.C))
pl <- dropFirst(outF$m) + qnorm(0.05, sd=sqrt(v[-1]))
pu <- dropFirst(outF$m) + qnorm(0.95, sd=sqrt(v[-1]))
Since the dataset has 100 observations, I end up with a vector v that comprises 3636 \
atomic components: (1 + 100) x (6 x 6). If I discard the 1st 36 of them, then v \
comprises 3600 atomic components. The question is how to extract the variance of \
each state (6 states) in the 36 atomic components representing each time (1:100).
Said differently, how do I extract the variance of each state (6 states) in the 6 x 6 \
matrix generated by the "dlmDvd2var" function in time t? Is this information \
provided in the diagonal elements, element (1,1) for state 1, element (2,2) for state \
2, and so on?
Thank you in advance.
Ziad Elmously
Kantar Disclaimer<http://www.kantar.com/disclaimer.html>
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic