Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed MAE definitions in R Markdown vignette #62

Merged
merged 1 commit into from Dec 22, 2017

Conversation

jackiep00
Copy link
Contributor

While working through the demo vignette, I noticed that the MAE function was dividing by the sum of the actual estimates, rather than the number of users (to get the mean). Made a small correction.

@lintr-bot
Copy link

tests/testthat/test-bg-cnbd-k.R:31:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.ConditionalExpectedTransactions(params[-1], 32, 1, 16, 32),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:36:1: style: lines should not be more than 80 characters.

​               bgcnbd.PlotFrequencyInCalibration(params, cbs, 7), tolerance = 0.01)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:37:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.PlotFreqVsConditionalExpectedFrequency(params[-1], T.star = 39, cbs, cbs$x.star, 7),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:38:1: style: lines should not be more than 80 characters.

​               bgcnbd.PlotFreqVsConditionalExpectedFrequency(params, T.star = 39, cbs, cbs$x.star, 7), tolerance = 0.01)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:39:1: style: lines should not be more than 80 characters.

# Note: BTYD::bgnbd.PlotRecVsConditionalExpectedFrequency can't handle missing bins, so we can't compare
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:40:1: style: lines should not be more than 80 characters.

​  expect_silent(bgcnbd.PlotRecVsConditionalExpectedFrequency(params, cbs, T.star = 39, cbs$x.star))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:42:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.PlotTrackingInc(params[-1], cbs$T.cal, max(cbs$T.cal) + 32, inc_tracking),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:43:1: style: lines should not be more than 80 characters.

​               bgcnbd.PlotTrackingInc(params, cbs$T.cal, max(cbs$T.cal) + 32, inc_tracking),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:45:1: style: lines should not be more than 80 characters.

​  expect_silent(bgcnbd.PlotTrackingInc(params, cbs$T.cal, max(cbs$T.cal) + 32, inc_tracking,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:47:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.ExpectedCumulativeTransactions(params[-1], 11, 39, 12),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:51:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.PlotTrackingCum(params[-1], cbs$T.cal, 32 + 32, cu_tracking),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:69:1: style: lines should not be more than 80 characters.

est_fixed_k <- bgcnbd.EstimateParameters(cbs[, c("x", "t.x", "T.cal", "litt")], k = params[1])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:76:1: style: lines should not be more than 80 characters.

cbs$x.est32 <- bgcnbd.ConditionalExpectedTransactions(params, 32, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:77:1: style: lines should not be more than 80 characters.

cbs$x.est64 <- bgcnbd.ConditionalExpectedTransactions(params, 64, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:5:1: style: lines should not be more than 80 characters.

elog <- data.frame(cust = c(1, 1, 1, 1, 1, 2, 3), date = Sys.Date() + c(0, 14, 14, 28, 35, 7, 24))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:6:1: style: lines should not be more than 80 characters.

elog_time <- data.frame(cust = c(1, 1, 1, 1, 1, 2, 3), date = Sys.time() + c(0, 14, 14, 28, 35, 7, 24))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:7:14: style: Words within variable and function names should be separated by '_' rather than '.'.

elog_dt <- as.data.table(elog)
             ^~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:19:1: style: lines should not be more than 80 characters.

​  expect_equal(elog2cbs(elog_time, units = "secs", T.cal = as.character(min(elog_time$date) + 21))[, 1:4],
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:20:1: style: lines should not be more than 80 characters.

​               elog2cbs(elog, units = "days", T.cal = as.character(Sys.Date() + 21))[, 1:4])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:28:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "sales", "sales.x", "first", "T.cal"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:30:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "sales", "sales.x", "first", "T.cal", "T.star", "x.star", "sales.star"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:32:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "first", "T.cal", "T.star", "x.star"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:34:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "first", "T.cal", "T.star", "x.star"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:37:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog$cust), nrow(elog2cbs(elog)))
               ^~~~~~~

tests/testthat/test-elog2cbs.R:38:1: style: lines should not be more than 80 characters.

​  expect_equal(uniqueN(elog[elog$date <= T.cal, "cust"]), nrow(elog2cbs(elog, T.cal = T.cal)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:38:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog[elog$date <= T.cal, "cust"]), nrow(elog2cbs(elog, T.cal = T.cal)))
               ^~~~~~~

tests/testthat/test-elog2cbs.R:42:1: style: lines should not be more than 80 characters.

​  expect_equal(uniqueN(elog_dt[, .(cust, date)]), sum(cbs$x) + sum(cbs$x.star) + nrow(cbs))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:42:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog_dt[, .(cust, date)]), sum(cbs$x) + sum(cbs$x.star) + nrow(cbs))
               ^~~~~~~

tests/testthat/test-elog2cbs.R:47:1: style: lines should not be more than 80 characters.

​  expect_equal(uniqueN(elog_dt[elog_dt$first <= T.cal & date <= T.tot, .(cust, date)]),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:47:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog_dt[elog_dt$first <= T.cal & date <= T.tot, .(cust, date)]),
               ^~~~~~~

tests/testthat/test-elog2cbs.R:52:1: style: lines should not be more than 80 characters.

​  expect_equal(elog_s[first <= T.cal & date <= T.cal, sum(sales)], sum(cbs$sales))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:53:1: style: lines should not be more than 80 characters.

​  expect_equal(elog_s[first < date & first <= T.cal & date <= T.cal, sum(sales)], sum(cbs$sales.x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:54:1: style: lines should not be more than 80 characters.

​  expect_equal(elog_s[first <= T.cal & date <= T.tot, sum(sales)], sum(cbs$sales) + sum(cbs$sales.star))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:57:1: style: lines should not be more than 80 characters.

cbs <- elog2cbs(elog_s, T.cal = as.character(T.cal), T.tot = as.character(T.tot))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:65:1: style: lines should not be more than 80 characters.

​  expect_equal(elog2cbs(elog, units = "hours")$t.x / (7 * 24), elog2cbs(elog)$t.x)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:66:1: style: lines should not be more than 80 characters.

elog_time <- data.frame(cust = c(1, 1, 1, 1, 1, 2, 3), date = Sys.time() + c(0, 14, 14, 28, 35, 7, 24))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:67:1: style: lines should not be more than 80 characters.

​  expect_equal(elog2cbs(elog, units = "days")[, c(1:4, 6)], elog2cbs(elog_time, units = "secs")[, c(1:4, 6)])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:72:30: style: Words within variable and function names should be separated by '_' rather than '.'.

​  expect_equal(nrow(elog2cbs(as.data.table(empty_elog))), 0)
                             ^~~~~~~~~~~~~

tests/testthat/test-helpers.R:8:1: style: lines should not be more than 80 characters.

​  expect_silent(BTYDplus:::dc.check.model.params.safe(printnames, params, "foo"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:12:1: style: lines should not be more than 80 characters.

​  expect_silent(BTYDplus:::dc.check.model.params.safe(printnames, params, "foo"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:25:1: style: lines should not be more than 80 characters.

col.names = c("cust", "sampleid", "date", "cds", "sales"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:28:15: style: Variable and function names should be all lowercase.

utils::data(cdnowSummary, package = "BTYD", envir = environment())
              ^~~~~~~~~~~~

tests/testthat/test-helpers.R:29:21: style: Variable and function names should be all lowercase.

​  expect_equal(cum, cdnowSummary$cu.tracking)
                    ^~~~~~~~~~~~

tests/testthat/test-helpers.R:37:1: style: lines should not be more than 80 characters.

​  expect_equal(diff(elog2cum(elog, by = 7, first = TRUE)), elog2inc(elog, by = 7, first = TRUE))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:39:1: style: lines should not be more than 80 characters.

​  expect_equal(tail(elog2cum(elog, by = 1, first = FALSE), 1), nrow(elog) - uniqueN(elog$cust))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:39:77: style: Variable and function names should be all lowercase.

​  expect_equal(tail(elog2cum(elog, by = 1, first = FALSE), 1), nrow(elog) - uniqueN(elog$cust))
                                                                            ^~~~~~~

tests/testthat/test-helpers.R:41:1: style: lines should not be more than 80 characters.

elog <- data.table(cust = c(1, 1, 1, 1, 1, 3, 3), t = c(0, 9, 9, 20, 22, 4, 6))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:51:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(groceryElog, headers = c("X", "Y"), title = ""))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:52:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(groceryElog, T.cal = "2006-12-31", title = NULL))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:53:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(groceryElog, T.cal = "2006-12-31", T.tot = "2007-06-30",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:57:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(head(groceryElog, 10), T.cal = "2006-12-31", T.tot = "2007-12-30"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:20:1: style: lines should not be more than 80 characters.

est2 <- mbgcnbd.EstimateParameters(cbs[, c("x", "t.x", "T.cal", "litt")], k = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:28:1: style: lines should not be more than 80 characters.

cbs$x.est <- mbgcnbd.ConditionalExpectedTransactions(params, cbs$T.star, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:47:1: style: lines should not be more than 80 characters.

​  expect_silent(mbgcnbd.PlotTrackingInc(params, cbs$T.cal, max(cbs$T.cal + cbs$T.star), elog2inc(elog, by = 14)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:48:1: style: lines should not be more than 80 characters.

​  expect_silent(mbgcnbd.PlotTrackingCum(params, cbs$T.cal, max(cbs$T.cal + cbs$T.star), elog2cum(elog, by = 14)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:51:1: style: lines should not be more than 80 characters.

mat <- mbgcnbd.PlotFreqVsConditionalExpectedFrequency(params, cbs$T.star, cbs, cbs$x.star, 7)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:55:1: style: lines should not be more than 80 characters.

​  expect_lt(mbgcnbd.ConditionalExpectedTransactions(params, T.star = 32, x = c(0, 1), t.x = c(0, 12), T.cal = 32)[2], 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:56:1: style: lines should not be more than 80 characters.

​  expect_true(mbgcnbd.ConditionalExpectedTransactions(params, T.star = 32, x = 3, t.x = 12, T.cal = 32) !=
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:57:1: style: lines should not be more than 80 characters.

​                mbgcnbd.ConditionalExpectedTransactions(params, T.star = 32, x = 2, t.x = 12, T.cal = 32))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:67:1: style: lines should not be more than 80 characters.

cbs$x.est <- mbgcnbd.ConditionalExpectedTransactions(params, cbs$T.star, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:17:1: style: lines should not be more than 80 characters.

abe_params$beta <- matrix(c(0.18, -2.5, 0.5, -0.3, -0.2, 0.8), byrow = TRUE, ncol = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:20:1: style: lines should not be more than 80 characters.

abe_draws <- abe.mcmc.DrawParameters(abe_cbs, c("covariate_1", "covariate_2"), mcmc, burnin, thin, chains)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:25:1: style: lines should not be more than 80 characters.

pggg_draws <- pggg.mcmc.DrawParameters(pggg_cbs, mcmc / 10, burnin / 10, thin / 10, chains)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:32:1: style: lines should not be more than 80 characters.

pnbd_xstar_draws1 <- mcmc.DrawFutureTransactions(pnbd_cbs, pnbd_draws, sample_size = size)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:35:1: style: lines should not be more than 80 characters.

pnbd_xstar_draws2 <- mcmc.DrawFutureTransactions(pnbd_cbs, pnbd_draws, sample_size = size)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:37:1: style: lines should not be more than 80 characters.

​  expect_gt(cor(apply(pnbd_xstar_draws2, 2, mean), apply(pnbd_xstar_draws, 2, mean)), 0.95)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:38:1: style: lines should not be more than 80 characters.

​  expect_silent(pnbd_xstar_draws <- mcmc.DrawFutureTransactions(pnbd_cbs, pnbd_draws, T.star = 10))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:46:1: style: lines should not be more than 80 characters.

​  expect_equal(dim(pnbd_xstar_draws3), c((mcmc + burnin - burnin2) * chains / thin, nrow(pnbd_cbs)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:46:42: style: Place a space before left parenthesis, except in a function call.

​  expect_equal(dim(pnbd_xstar_draws3), c((mcmc + burnin - burnin2) * chains / thin, nrow(pnbd_cbs)))
                                         ^

tests/testthat/test-mcmc.R:85:1: style: lines should not be more than 80 characters.

​  expect_equal(mcmc.Expectation(pnbd_draws, 28), mean(pnbd_cbs$x), tolerance = 0.1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:86:1: style: lines should not be more than 80 characters.

x <- mcmc.ExpectedCumulativeTransactions(pnbd_draws, T.cal = pnbd_cbs$T.cal, T.tot = 56, n.periods.final = 56)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:99:1: style: lines should not be more than 80 characters.

BTYD::pnbd.PlotFrequencyInCalibration(unlist(pnbd_params), pnbd_cbs, censor = 7),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-nbd.R:18:1: style: lines should not be more than 80 characters.

cbs$x.est <- nbd.ConditionalExpectedTransactions(params, cbs$T.star, cbs$x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:12:37: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- pggg.mcmc.DrawParameters(as.data.table(cbs),
                                    ^~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:13:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:14:1: style: lines should not be more than 80 characters.

param_init = list(r = 1, alpha = 1, s = 1, beta = 1, t = 1, gamma = 1))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:16:1: style: lines should not be more than 80 characters.

mcmc = 100, burnin = 20, thin = 10, chains = 2, mc.cores = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:9:1: style: lines should not be more than 80 characters.

params$beta <- matrix(c(0.18, -2.5, 0.5, -0.3, -0.2, 0.8), byrow = TRUE, ncol = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:12:1: style: lines should not be more than 80 characters.

covariates = matrix(c(rnorm(n), runif(n)), ncol = 2)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:14:1: style: lines should not be more than 80 characters.

covariates = matrix(c(rnorm(n), runif(n)), ncol = 2,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:15:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, c("x1", "x2")))))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:18:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, c("x1")))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:21:1: style: lines should not be more than 80 characters.

covariates = matrix(c(rnorm(n), runif(n), runif(n)), ncol = 3,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:22:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, c("x1", "x2", "x3")))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:26:1: style: lines should not be more than 80 characters.

​  expect_silent(abe.GenerateData(n, 36, 36, params, covariates = matrix(rnorm(n), ncol = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:27:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, "x1"))))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:32:1: style: lines should not be more than 80 characters.

params$beta <- matrix(c(0.18, -2.5, 0.5, -0.3, -0.2, 0.8), byrow = TRUE, ncol = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:40:1: style: lines should not be more than 80 characters.

# TODO: test param recoverability with covars being provided to abe.GenerateData
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:48:36: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- abe.mcmc.DrawParameters(as.data.table(cbs),
                                   ^~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:49:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:50:1: style: lines should not be more than 80 characters.

draws <- abe.mcmc.DrawParameters(as.data.table(cbs), covariates = c("covariate_1"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:50:36: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- abe.mcmc.DrawParameters(as.data.table(cbs), covariates = c("covariate_1"),
                                   ^~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:51:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:54:1: style: lines should not be more than 80 characters.

draws <- abe.mcmc.DrawParameters(cbs, covariates = c("covariate_1", "covariate_2"), mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:57:1: style: lines should not be more than 80 characters.

​  expect_true(all(c("lambda", "mu", "z", "tau") %in% colnames(as.matrix(draws$level_1[[1]]))))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:58:1: style: lines should not be more than 80 characters.

​  expect_true(all(c("log_lambda_intercept", "log_mu_intercept", "log_lambda_covariate_1", "log_mu_covariate_1",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:59:1: style: lines should not be more than 80 characters.

"log_lambda_covariate_2", "log_mu_covariate_2", "var_log_lambda", "cov_log_lambda_log_mu", "var_log_mu") %in%
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:67:1: style: lines should not be more than 80 characters.

​  expect_equal(matrix(est[1:6], ncol = 2, byrow = T), params$beta, tolerance = 0.05)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:70:1: style: lines should not be more than 80 characters.

​  expect_equal(unname(est["var_log_lambda"]), params$gamma[1, 1], tolerance = 0.1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:71:1: style: lines should not be more than 80 characters.

​  expect_equal(unname(est["cov_log_lambda_log_mu"]), params$gamma[1, 2], tolerance = 0.1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:95:1: style: lines should not be more than 80 characters.

covariates = cbs[, c("covariate_1", "covariate_2")])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:103:1: style: lines should not be more than 80 characters.

covariates = cbs[, c("covariate_1", "covariate_2")])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:17:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(sim$elog$cust), n)
               ^~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:30:1: style: lines should not be more than 80 characters.

sim <- pggg.GenerateData(100, 52, c(26, 104), params, date.zero = as.Date("2010-01-01"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:61:37: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- pnbd.mcmc.DrawParameters(as.data.table(cbs),
                                    ^~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:62:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:63:1: style: lines should not be more than 80 characters.

param_init = list(r = 1, alpha = 1, s = 1, beta = 1))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:95:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 2, chains = 2,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:96:1: style: lines should not be more than 80 characters.

use_data_augmentation = FALSE, mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-timing.R:17:1: style: lines should not be more than 80 characters.

​  expect_error(k_est_1 <- estimateRegularity(elog, plot = TRUE, min = 60), "sufficient")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-timing.R:21:1: style: lines should not be more than 80 characters.

k_est_3 <- estimateRegularity(elog, method = "mle-minka", plot = TRUE, title = "Plot Title")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-timing.R:22:1: style: lines should not be more than 80 characters.

k_est_4 <- estimateRegularity(elog, method = "mle-thom", plot = TRUE, title = "")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@mplatzer mplatzer merged commit e6d9300 into mplatzer:master Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants