Skip to content

Commit bfffbc1

Browse files
Added tidy method
Related: #39
1 parent dc1fb83 commit bfffbc1

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ S3method(print,FASSTER)
99
S3method(report,FASSTER)
1010
S3method(residuals,FASSTER)
1111
S3method(stream,FASSTER)
12+
S3method(tidy,FASSTER)
1213
export(FASSTER)
1314
export(fasster)
1415
import(dlm)

R/model.R

+18
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,24 @@ print.FASSTER <- function(x, ...){
239239
cat(format(x))
240240
}
241241

242+
#' Extract coefficients from a FASSTER model
243+
#'
244+
#' Obtains the mean and variance of the estimated initial states from a FASSTER
245+
#' model. Values in the `estimate` column are contains the mean, and the
246+
#' `std.error` column contains the standard deviation of the initial states.
247+
#'
248+
#' @param x An object containing a FASSTER model.
249+
#' @param ... Unused.
250+
#'
251+
#' @export
252+
tidy.FASSTER <- function(x, ...){
253+
tibble(
254+
term = colnames(x[["dlm"]][["FF"]]),
255+
estimate = x[["dlm"]][["m0"]],
256+
std.error = sqrt(diag(x[["dlm"]][["C0"]]))
257+
)
258+
}
259+
242260
#' @export
243261
#' @importFrom rlang as_quosure sym
244262
report.FASSTER <- function(object, ...){

man/tidy.FASSTER.Rd

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)