Skip to content

Commit

Permalink
Added tidy method
Browse files Browse the repository at this point in the history
Related: #39
  • Loading branch information
mitchelloharawild committed Aug 16, 2019
1 parent dc1fb83 commit bfffbc1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ S3method(print,FASSTER)
S3method(report,FASSTER)
S3method(residuals,FASSTER)
S3method(stream,FASSTER)
S3method(tidy,FASSTER)
export(FASSTER)
export(fasster)
import(dlm)
Expand Down
18 changes: 18 additions & 0 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,24 @@ print.FASSTER <- function(x, ...){
cat(format(x))
}

#' Extract coefficients from a FASSTER model
#'
#' Obtains the mean and variance of the estimated initial states from a FASSTER
#' model. Values in the `estimate` column are contains the mean, and the
#' `std.error` column contains the standard deviation of the initial states.
#'
#' @param x An object containing a FASSTER model.
#' @param ... Unused.
#'
#' @export
tidy.FASSTER <- function(x, ...){
tibble(
term = colnames(x[["dlm"]][["FF"]]),
estimate = x[["dlm"]][["m0"]],
std.error = sqrt(diag(x[["dlm"]][["C0"]]))
)
}

#' @export
#' @importFrom rlang as_quosure sym
report.FASSTER <- function(object, ...){
Expand Down
18 changes: 18 additions & 0 deletions man/tidy.FASSTER.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bfffbc1

Please sign in to comment.