Skip to content

Commit 8e354a9

Browse files
authored
Merge pull request #71 from SebKrantz/development
Using <- instead of = in Examples.
2 parents 9f496df + d6ce2ba commit 8e354a9

File tree

9 files changed

+32
-32
lines changed

9 files changed

+32
-32
lines changed

R/DFM.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
#' library(vars)
134134
#'
135135
#' # BM14 Replication Data. Constructing the database:
136-
#' BM14 = merge(BM14_M, BM14_Q)
136+
#' BM14 <- merge(BM14_M, BM14_Q)
137137
#' BM14[, BM14_Models$log_trans] %<>% log()
138138
#' BM14[, BM14_Models$freq == "M"] %<>% diff()
139139
#' BM14[, BM14_Models$freq == "Q"] %<>% diff(3)
@@ -142,15 +142,15 @@
142142
#' ### Small Model ---------------------------------------
143143
#'
144144
#' # IC for number of factors
145-
#' IC_small = ICr(BM14[, BM14_Models$small], max.r = 5)
145+
#' IC_small <- ICr(BM14[, BM14_Models$small], max.r = 5)
146146
#' plot(IC_small)
147147
#' screeplot(IC_small)
148148
#'
149149
#' # I take 2 factors. Now number of lags
150150
#' VARselect(IC_small$F_pca[, 1:2])
151151
#'
152152
#' # Estimating the model with 2 factors and 3 lags
153-
#' dfm_small = DFM(BM14[, BM14_Models$small], r = 2, p = 3,
153+
#' dfm_small <- DFM(BM14[, BM14_Models$small], r = 2, p = 3,
154154
#' quarterly.vars = BM14_Models %$% series[freq == "Q" & small])
155155
#'
156156
#' # Inspecting the model
@@ -166,15 +166,15 @@
166166
#' ### Medium-Sized Model ---------------------------------
167167
#'
168168
#' # IC for number of factors
169-
#' IC_medium = ICr(BM14[, BM14_Models$medium])
169+
#' IC_medium <- ICr(BM14[, BM14_Models$medium])
170170
#' plot(IC_medium)
171171
#' screeplot(IC_medium)
172172
#'
173173
#' # I take 3 factors. Now number of lags
174174
#' VARselect(IC_medium$F_pca[, 1:3])
175175
#'
176176
#' # Estimating the model with 3 factors and 3 lags
177-
#' dfm_medium = DFM(BM14[, BM14_Models$medium], r = 3, p = 3,
177+
#' dfm_medium <- DFM(BM14[, BM14_Models$medium], r = 3, p = 3,
178178
#' quarterly.vars = BM14_Models %$% series[freq == "Q" & medium])
179179
#'
180180
#' # Inspecting the model
@@ -190,15 +190,15 @@
190190
#' ### Large Model ---------------------------------
191191
#' \donttest{
192192
#' # IC for number of factors
193-
#' IC_large = ICr(BM14)
193+
#' IC_large <- ICr(BM14)
194194
#' plot(IC_large)
195195
#' screeplot(IC_large)
196196
#'
197197
#' # I take 6 factors. Now number of lags
198198
#' VARselect(IC_large$F_pca[, 1:6])
199199
#'
200200
#' # Estimating the model with 6 factors and 3 lags
201-
#' dfm_large = DFM(BM14, r = 6, p = 3,
201+
#' dfm_large <- DFM(BM14, r = 6, p = 3,
202202
#' quarterly.vars = BM14_Models %$% series[freq == "Q"])
203203
#'
204204
#' # Inspecting the model

R/methods.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ summary.dfm <- function(object, method = switch(object$em.method, none = "2s", "
128128
#' @param \dots not used.
129129
#'
130130
#' @examples
131-
#' mod = DFM(diff(BM14_Q), 2, 3)
131+
#' mod <- DFM(diff(BM14_Q), 2, 3)
132132
#' print(mod)
133133
#' summary(mod)
134134
#'
@@ -195,7 +195,7 @@ print.dfm_summary <- function(x,
195195
#' @seealso \link{dfms-package}
196196
#' @examples \donttest{
197197
#' # Fit DFM with 3 factors and 3 lags in the transition equation
198-
#' mod = DFM(diff(BM14_M), r = 3, p = 3)
198+
#' mod <- DFM(diff(BM14_M), r = 3, p = 3)
199199
#' plot(mod)
200200
#' plot(mod, type = "individual", method = "all")
201201
#' plot(mod, type = "residual")
@@ -293,14 +293,14 @@ plot.dfm <- function(x,
293293
#' @examples \donttest{
294294
#' library(xts)
295295
#' # Fit DFM with 3 factors and 3 lags in the transition equation
296-
#' mod = DFM(diff(BM14_M), r = 3, p = 3)
296+
#' mod <- DFM(diff(BM14_M), r = 3, p = 3)
297297
#'
298298
#' # Taking a single estimate:
299299
#' print(head(as.data.frame(mod, method = "qml")))
300300
#' print(head(as.data.frame(mod, method = "qml", pivot = "wide")))
301301
#'
302302
#' # Adding a proper time variable
303-
#' time = index(BM14_M)[-1L]
303+
#' time <- index(BM14_M)[-1L]
304304
#' print(head(as.data.frame(mod, method = "qml", time = time)))
305305
#'
306306
#' # All estimates: different pivoting methods
@@ -395,7 +395,7 @@ predict_dfm_core <- function(object, method) {
395395
#' @examples \donttest{
396396
#' library(xts)
397397
#' # Fit DFM with 3 factors and 3 lags in the transition equation
398-
#' mod = DFM(diff(BM14_M), r = 3, p = 3)
398+
#' mod <- DFM(diff(BM14_M), r = 3, p = 3)
399399
#'
400400
#' # Residuals
401401
#' head(resid(mod))
@@ -494,16 +494,16 @@ fitted.dfm <- function(object,
494494
#' library(collapse)
495495
#'
496496
#' # Fit DFM with 3 factors and 3 lags in the transition equation
497-
#' mod = DFM(diff(BM14_M), r = 3, p = 3)
497+
#' mod <- DFM(diff(BM14_M), r = 3, p = 3)
498498
#'
499499
#' # 15 period ahead forecast
500-
#' fc = predict(mod, h = 15)
500+
#' fc <- predict(mod, h = 15)
501501
#' print(fc)
502502
#' plot(fc, xlim = c(300, 370))
503503
#'
504504
#' # Also forecasting autocorrelated residuals with an AR(1)
505505
#' fcfun <- function(x, h) predict(ar(na_rm(x)), n.ahead = h)$pred
506-
#' fcar = predict(mod, resFUN = fcfun, h = 15)
506+
#' fcar <- predict(mod, resFUN = fcfun, h = 15)
507507
#' plot(fcar, xlim = c(300, 370))
508508
#'
509509
#' # Retrieving a data frame of the forecasts
@@ -809,7 +809,7 @@ as.data.frame.dfm_forecast <- function(x, ...,
809809
#' library(xts)
810810
#' library(vars)
811811
#'
812-
#' ics = ICr(diff(BM14_M))
812+
#' ics <- ICr(diff(BM14_M))
813813
#' print(ics)
814814
#' plot(ics)
815815
#' screeplot(ics)

man/DFM.Rd

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ICr.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/as.data.frame.dfm.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot.dfm.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/predict.dfm.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/residuals.dfm.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/summary.dfm.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)