Skip to content

Commit

Permalink
Create class for test stats
Browse files Browse the repository at this point in the history
  • Loading branch information
franzmohr committed Jul 8, 2023
1 parent 9b059d4 commit 5bf8df8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Collate:
'plot.bgvarprd.R'
'plot.bgvecest.R'
'plot.ctryvarest.R'
'plot.ctryvartest.R'
'plot.ctryvecest.R'
'plot.teststats.bgvarest.R'
'predict.bgvar.R'
'summary.bgvarest.R'
'print.summary.bgvarest.R'
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ S3method(plot,bgvarirf)
S3method(plot,bgvarprd)
S3method(plot,bgvecest)
S3method(plot,ctryvarest)
S3method(plot,ctryvartest)
S3method(plot,ctryvecest)
S3method(plot,teststats.bgvarest)
S3method(predict,bgvar)
S3method(print,summary.bgvarest)
S3method(print,summary.bgvecest)
Expand Down
2 changes: 1 addition & 1 deletion R/plot.ctryvartest.R → R/plot.teststats.bgvarest.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @param ... further graphical parameters.
#'
#' @export
plot.ctryvartest <- function(x, ctry = NULL, ...) {
plot.teststats.bgvarest <- function(x, ctry = NULL, ...) {

if (is.null(ctry)) {
pos <- 1:length(x)
Expand Down
4 changes: 2 additions & 2 deletions R/select_submodels.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ select_submodels <- function(object, ic = "BIC", select = "order", teststats = N
criteria <- submodel_test_statistics(object)
} else {
# Basic checks
if (!"ctryvartest" %in% class(teststats)) {
stop("If provided, argument 'teststats' must be of class ctryvartest.")
if (!"teststats.bgvarest" %in% class(teststats)) {
stop("If provided, argument 'teststats' must be of class teststats.bgvarest")
}
criteria <- teststats
}
Expand Down
3 changes: 2 additions & 1 deletion R/submodel_test_statistics.R
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ submodel_test_statistics <- function(object, ...){
rownames(result[[current_ctry]][["teststats"]]) <- NULL
result[[current_ctry]][["loglik"]] <- loglik
loglik <- list()
class(result[[current_ctry]]) <- c("teststats.ctryvarest", "list")
}

utils::setTxtProgressBar(pb, i / n_models)
Expand All @@ -269,7 +270,7 @@ submodel_test_statistics <- function(object, ...){
return(x)
})

class(result) <- c("ctryvartest", "list")
class(result) <- c("teststats.bgvarest", "list")

return(result)
}
8 changes: 4 additions & 4 deletions man/plot.ctryvartest.Rd → man/plot.teststats.bgvarest.Rd

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

0 comments on commit 5bf8df8

Please sign in to comment.