@@ -40,3 +40,76 @@ test_that("jvn_nowcast returns expected components", {
4040 " bic" , " convergence" , " data" )
4141 )
4242})
43+
44+ test_that(" jvn_nowcast works with different solvers" , {
45+ result <- jvn_nowcast(
46+ df = df_jvn , e = 2 , h = 0 ,
47+ solver_options = list (method = " BFGS" )
48+ )
49+ expect_named(
50+ result ,
51+ c(" states" , " jvn_model_mat" , " params" , " fit" , " loglik" , " aic" ,
52+ " bic" , " convergence" , " data" )
53+ )
54+
55+ result <- jvn_nowcast(
56+ df = df_jvn , e = 2 , h = 0 ,
57+ solver_options = list (method = " nlminb" )
58+ )
59+ expect_named(
60+ result ,
61+ c(" states" , " jvn_model_mat" , " params" , " fit" , " loglik" , " aic" ,
62+ " bic" , " convergence" , " data" )
63+ )
64+
65+ result <- jvn_nowcast(
66+ df = df_jvn , e = 2 , h = 0 ,
67+ solver_options = list (method = " two-step" )
68+ )
69+ expect_named(
70+ result ,
71+ c(" states" , " jvn_model_mat" , " params" , " fit" , " loglik" , " aic" ,
72+ " bic" , " convergence" , " data" )
73+ )
74+
75+ result <- jvn_nowcast(
76+ df = df_jvn , e = 2 , h = 0 ,
77+ solver_options = list (n_starts = 2 )
78+ )
79+ expect_named(
80+ result ,
81+ c(" states" , " jvn_model_mat" , " params" , " fit" , " loglik" , " aic" ,
82+ " bic" , " convergence" , " data" )
83+ )
84+ })
85+
86+ test_that(" jvn_nowcast works with spillovers" , {
87+ result <- jvn_nowcast(
88+ df = df_jvn , e = 2 , h = 0 ,
89+ include_spillovers = T
90+ )
91+ expect_named(
92+ result ,
93+ c(" states" , " jvn_model_mat" , " params" , " fit" , " loglik" , " aic" ,
94+ " bic" , " convergence" , " data" )
95+ )
96+ })
97+
98+ test_that(" jvn_nowcast works with trace = 1" , {
99+ result <- jvn_nowcast(
100+ df = df_jvn , e = 2 , h = 0 ,
101+ solver_options = list (" trace" = 1 )
102+ )
103+ expect_named(
104+ result ,
105+ c(" states" , " jvn_model_mat" , " params" , " fit" , " loglik" , " aic" ,
106+ " bic" , " convergence" , " data" )
107+ )
108+ })
109+
110+ test_that(" plot returns a ggplot object" , {
111+ result <- jvn_nowcast(df_jvn , e = 2 , h = 0 )
112+ p <- plot(result )
113+ expect_s3_class(p , " ggplot" )
114+ })
115+
0 commit comments