Skip to content

Commit

Permalink
Merge pull request #116 from statgenlmu/fix_type_error
Browse files Browse the repository at this point in the history
Fix type error
  • Loading branch information
paulstaab committed Jan 25, 2016
2 parents 28ff8f1 + a421b16 commit 8bb9b03
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 18 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: jaatha
Version: 3.0.0.9007
Date: 2016-01-06
Version: 3.0.0.9008
Date: 2016-01-25
License: GPL (>= 3)
Title: Simulation-Based Maximum Likelihood Parameter Estimation
Authors@R: c(
Expand Down
4 changes: 2 additions & 2 deletions R/coala_interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ coarsen_jsfs <- function(ja, part, part_hi = NULL) {
part[[i]] <- c(0, part[[i]], dim(ja)[i])
}

z <- numeric(length = prod(sapply(part, length) - 1))
z <- numeric(length = prod(vapply(part, length, numeric(1)) - 1))
combinations <-
expand.grid(lapply(sapply(part, length) - 1, ":", 1))[length(z):1, ]
expand.grid(lapply(vapply(part, length, numeric(1)) - 1, ":", 1))[length(z):1, ]

for (i in 1:length(z)) {
comb <- combinations[i, ]
Expand Down
4 changes: 2 additions & 2 deletions R/likelihood.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ approximate_llh.jaatha_model <- function(x, data, param, glm_fitted, sim) {
approximate_llh.jaatha_stat_basic <- function(x, data, param, glm_fitted,
sim, scaling_factor) {

loglambda <- sapply(glm_fitted[[x$get_name()]], function(glm_obj) {
loglambda <- vapply(glm_fitted[[x$get_name()]], function(glm_obj) {
glm_obj$coefficients %*% c(1, param)
})
}, numeric(1))

# Calculate the Poission log-likelihood
calc_poisson_llh(data, x, loglambda, sim, scaling_factor)
Expand Down
2 changes: 1 addition & 1 deletion R/stat_cube.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ stat_cube_class <- R6Class("stat_cube", inherit = stat_basic_class,
}

# Count the classes and return as vector
dims <- sapply(break_values, length) + 1
dims <- vapply(break_values, length, numeric(1)) + 1
factors <- cumprod(c(1, dims[-length(dims)]))
classes_int <- apply(locus_class, 1, function(x) sum((x - 1)*factors) + 1)
tabulate(classes_int, nbins = prod(dims))
Expand Down
11 changes: 0 additions & 11 deletions tests/testthat/test-jaatha-function.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,3 @@ test_that("it supports a one parameter model", {
expect_equal(results$args$cores, 1)
expect_equal(results$args$max_steps, 15)
})


test_that("An error is thrown if all glms fail to converge", {
model <- create_jaatha_model(function(x) rpois(10, x),
par_ranges = matrix(c(0.1, 0.1, 10, 10), 2, 2),
sum_stats = list(create_jaatha_stat("null", function(x, y) 0)),
test = FALSE)
data <- create_test_data(model)

expect_error(jaatha(model, data, repetitions = 2, sim = 10, cores = 1))
})

1 comment on commit 8bb9b03

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/block.R:2:32: style: Trailing whitespace is superfluous.

block_class <- R6Class("Block", 
                               ^

R/block.R:8:29: style: Do not place spaces around code in parentheses or square brackets.

​      assert_that(all(border[ , 1] < border[ , 2]))
                            ^

R/block.R:9:31: style: Commas should never have a space before.

​      assert_that(all(border[ , 1] < border[ , 2]))
                             ~^

R/block.R:9:46: style: Commas should never have a space before.

​      assert_that(all(border[ , 1] < border[ , 2]))
                                            ~^

R/block.R:20:42: style: Do not place spaces around code in parentheses or square brackets.

upper <- denormalize(private$border[ , 2], jaatha)
                                         ^

R/block.R:20:44: style: Commas should never have a space before.

lower <- denormalize(private$border[ , 1], jaatha)
                                          ~^

R/block.R:21:44: style: Commas should never have a space before.

upper <- denormalize(private$border[ , 2], jaatha)
                                          ~^

R/block.R:25:27: style: Commas should never have a space before.

​      all(private$border[ , 1] - 1e-15 <= point & 
                         ~^

R/block.R:25:50: style: Trailing whitespace is superfluous.

​      all(private$border[ , 1] - 1e-15 <= point & 
                                                 ^

R/block.R:26:38: style: Commas should never have a space before.

point <= private$border[ , 2] + 1e-15)
                                    ~^

R/block.R:28:27: style: Do not place spaces around code in parentheses or square brackets.

m <- (private$border[ , 2] - private$border[ , 1]) / 2 + 
                          ^

R/block.R:29:29: style: Commas should never have a space before.

m <- (private$border[ , 2] - private$border[ , 1]) / 2 + 
                           ~^

R/block.R:29:52: style: Commas should never have a space before.

m <- (private$border[ , 2] - private$border[ , 1]) / 2 + 
                                                  ~^

R/block.R:29:63: style: Trailing whitespace is superfluous.

m <- (private$border[ , 2] - private$border[ , 1]) / 2 + 
                                                              ^

R/block.R:30:25: style: Commas should never have a space before.

private$border[ , 1]
                       ~^

R/block.R:36:26: style: Commas should never have a space before.

private$border[i , , drop = FALSE]
                        ~^

R/block.R:36:28: style: Commas should never have a space before.

private$border[i , , drop = FALSE]
                          ~^

R/block.R:37:7: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​      }), KEEP.OUT.ATTRS = FALSE)
      ^

R/block.R:45:1: style: Trailing whitespace is superfluous.

^~~~~~

R/block.R:49:58: style: Do not place spaces around code in parentheses or square brackets.

max = self$get_border()[ , 2]),
                                                         ^

R/block.R:49:60: style: Commas should never have a space before.

min = self$get_border()[ , 1],
                                                          ~^

R/block.R:50:60: style: Commas should never have a space before.

max = self$get_border()[ , 2]),
                                                          ~^

R/block.R:52:1: style: Trailing whitespace is superfluous.

^~~~~~

R/boot_jaatha.R:24:3: warning: no visible global function definition for ‘require_package’

​  require_package("boot")
  ^~~~~~~~~~~~~~~

R/boot_jaatha.R:28:1: style: Trailing whitespace is superfluous.

^~

R/boot_jaatha.R:33:1: style: Trailing whitespace is superfluous.

^~

R/boot_jaatha.R:38:1: style: Trailing whitespace is superfluous.

^~~~

R/boot_jaatha.R:41:76: style: Trailing whitespace is superfluous.

file = tempfile(paste0("boot_log_", Sys.getpid(), "_")), 
                                                                           ^

R/boot_jaatha.R:43:1: style: Trailing whitespace is superfluous.

^~~~

R/boot_jaatha.R:46:1: style: Trailing whitespace is superfluous.

^~

R/boot_jaatha.R:49:5: warning: no visible global function definition for ‘create_jaatha_data.default’

​    create_jaatha_data.default(sim_data, model)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~

R/boot_jaatha.R:51:1: style: Trailing whitespace is superfluous.

^~

R/boot_jaatha.R:52:39: style: Trailing whitespace is superfluous.

boot::boot(data, jaatha_stat, R = R, 
                                      ^

R/boot_jaatha.R:53:33: style: Trailing whitespace is superfluous.

sim = "parametric", 
                                ^

R/boot_jaatha.R:54:38: style: Trailing whitespace is superfluous.

ran.gen = simulate_data, 
                                     ^

R/coala_interface.R:33:45: style: Trailing whitespace is superfluous.

create_jaatha_model.coalmodel <- function(x, 
                                            ^

R/coala_interface.R:44:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:45:3: warning: no visible global function definition for ‘require_package’

​  require_package("coala")
  ^~~~~~~~~~~~~~~

R/coala_interface.R:48:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:50:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:53:38: style: Commas should always have a space after.

par_ranges <- as.matrix(par_table[,-1])
                                     ^

R/coala_interface.R:60:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:61:64: style: Trailing whitespace is superfluous.

​  create_jaatha_model.function(sim_func, par_ranges, sum_stats, 
                                                               ^

R/coala_interface.R:69:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:70:3: warning: no visible global function definition for ‘require_package’

​  require_package("coala")
  ^~~~~~~~~~~~~~~

R/coala_interface.R:71:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.string(jsfs_summary))
  ^~~~~~~~~~~

R/coala_interface.R:71:15: warning: no visible global function definition for ‘is.string’

​  assert_that(is.string(jsfs_summary))
              ^~~~~~~~~

R/coala_interface.R:72:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:75:1: style: Trailing whitespace is superfluous.

^~~~

R/coala_interface.R:80:11: warning: no visible global function definition for ‘coarsen_jsfs’

​          coarsen_jsfs(x[[name]], jsfs_part, jsfs_part_hi)
          ^~~~~~~~~~~~

R/coala_interface.R:90:1: style: Trailing whitespace is superfluous.

^~~~

R/coala_interface.R:93:14: warning: no visible global function definition for ‘create_jaatha_stat’

return(create_jaatha_stat(name, function(x, opts) x[[name]]))
             ^~~~~~~~~~~~~~~~~~

R/coala_interface.R:95:1: style: Trailing whitespace is superfluous.

^~~~

R/coala_interface.R:99:20: style: Commas should never have a space before.

x[[name]][ , c(1, 2, 6), drop = FALSE]
                  ~^

R/coala_interface.R:100:7: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​      }, poisson = FALSE, breaks = four_gamete_breaks))
      ^

R/coala_interface.R:102:1: style: Trailing whitespace is superfluous.

^~~~

R/coala_interface.R:106:49: style: Trailing whitespace is superfluous.

poisson = FALSE, 
                                                ^

R/coala_interface.R:109:1: style: Trailing whitespace is superfluous.

^~~~

R/coala_interface.R:119:4: style: Commented code should be removed.

## A[p[1,1]:p[1:2],p[2,1]:p[2:2],...] consists of the same values as A[v],
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/coala_interface.R:122:12: style: Commas should always have a space after.

v <- p[N,1]:p[N,2]
           ^

R/coala_interface.R:122:19: style: Commas should always have a space after.

v <- p[N,1]:p[N,2]
                  ^

R/coala_interface.R:125:28: style: Place a space before left parenthesis, except in a function call.

v <- as.vector(outer((v - 1)*d[n], p[n, 1]:p[n, 2], "+"))
                           ^

R/coala_interface.R:125:35: style: Put spaces around all infix operators.

v <- as.vector(outer((v - 1)*d[n], p[n, 1]:p[n, 2], "+"))
                                 ~^~

R/coala_interface.R:128:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:177:26: style: Commas should always have a space after.

if (tail(part[[i]],1) >= upper[1]) {
                         ^

R/coala_interface.R:183:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:187:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:189:18: style: Trailing whitespace is superfluous.

combinations <- 
                 ^

R/coala_interface.R:190:1: style: lines should not be more than 80 characters.

​    expand.grid(lapply(vapply(part, length, numeric(1)) - 1, ":", 1))[length(z):1, ]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/coala_interface.R:191:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:199:20: warning: no visible global function definition for ‘multi_index_range’

z[i] <- sum(ja[multi_index_range(d, p)])
                   ^~~~~~~~~~~~~~~~~

R/coala_interface.R:201:1: style: Trailing whitespace is superfluous.

^~

R/coala_interface.R:204:1: style: Trailing whitespace is superfluous.

^~

R/fit_glm.R:8:52: style: Opening curly braces should never go on their own line and should always be followed by a new line.

fit_glm.jaatha_model <- function(x, sim_data, ...) { 
                                                   ^

R/fit_glm.R:8:53: style: Trailing whitespace is superfluous.

fit_glm.jaatha_model <- function(x, sim_data, ...) { 
                                                    ^

R/fit_glm.R:10:29: warning: no visible binding for global variable ‘fit_glm’

​  lapply(x$get_sum_stats(), fit_glm, sim_data, ...)
                            ^~~~~~~

R/fit_glm.R:19:16: style: Trailing whitespace is superfluous.

X <- cbind(1, 
               ^

R/fit_glm.R:21:1: style: Trailing whitespace is superfluous.

^~

R/fit_glm.R:24:21: style: Commas should never have a space before.

​      glm.fit(X, Y[ , i], family = poisson("log"), 
                   ~^

R/fit_glm.R:24:51: style: Trailing whitespace is superfluous.

​      glm.fit(X, Y[ , i], family = poisson("log"), 
                                                  ^

R/fit_glm.R:28:1: style: Trailing whitespace is superfluous.

^~

R/fit_glm.R:42:5: style: Commented code should be removed.

#   par_names <- names(sim_data[[1]]$pars)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/fit_glm.R:50:7: style: Commented code should be removed.

#     colnames(pars) <- names(sim_result$pars.normal)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/fit_glm.R:51:7: style: Commented code should be removed.

#     data.frame(pars, sim_result[[sum_stat$get_name()]])
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/fit_glm.R:57:5: style: Commented code should be removed.

#   if (!smooth_glm$converged) stop("GLM did not converge")
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/fit_glm.R:59:5: style: Commented code should be removed.

#   list(smooth=smooth_glm)
    ^~~~~~~~~~~~~~~~~~~~~~~

R/initialization.R:16:70: style: Trailing whitespace is superfluous.

get_start_pos <- function(model, data, reps, sim, init_method, cores, 
                                                                     ^

R/initialization.R:18:1: style: Trailing whitespace is superfluous.

^~

R/initialization.R:21:1: style: lines should not be more than 80 characters.

start_pos <- do_zoom_in_search(model, data, reps, sim, cores, sim_cache, block_width)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/initialization.R:21:18: warning: no visible global function definition for ‘do_zoom_in_search’

start_pos <- do_zoom_in_search(model, data, reps, sim, cores, sim_cache, block_width)
                 ^~~~~~~~~~~~~~~~~

R/initialization.R:23:18: warning: no visible global function definition for ‘do_initial_search’

start_pos <- do_initial_search(model, data, reps, sim, cores, sim_cache)
                 ^~~~~~~~~~~~~~~~~

R/initialization.R:27:62: style: Trailing whitespace is superfluous.

start_pos <- matrix(runif(reps * model$get_par_number()), 
                                                             ^

R/initialization.R:32:1: style: Trailing whitespace is superfluous.

^~

R/initialization.R:33:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.matrix(start_pos))
  ^~~~~~~~~~~

R/initialization.R:34:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(all((dim(start_pos) == c(reps, model$get_par_number()))))
  ^~~~~~~~~~~

R/initialization.R:34:19: style: Place a space before left parenthesis, except in a function call.

​  assert_that(all((dim(start_pos) == c(reps, model$get_par_number()))))
                  ^

R/initialization.R:40:1: style: lines should not be more than 80 characters.

"determines starting postions by cutting the parameters in equally sized blocks
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/initialization.R:44:21: warning: no visible global function definition for ‘determine_bpp’

blocks_per_par <- determine_bpp(par_number, reps)
                    ^~~~~~~~~~~~~

R/initialization.R:45:13: warning: no visible global function definition for ‘create_initial_blocks’

blocks <- create_initial_blocks(model$get_par_ranges(), blocks_per_par)
            ^~~~~~~~~~~~~~~~~~~~~

R/initialization.R:46:1: style: Trailing whitespace is superfluous.

^~

R/initialization.R:48:62: style: Trailing whitespace is superfluous.

estimates <- lapply(blocks, estimate_local_ml, model, data, 
                                                             ^

R/initialization.R:54:1: style: Trailing whitespace is superfluous.

^~

R/initialization.R:56:76: style: Trailing whitespace is superfluous.

best_indexes <- order(vapply(estimates, function(x) x$value, numeric(1)), 
                                                                           ^

R/initialization.R:58:55: style: Trailing whitespace is superfluous.

​  t(vapply(estimates[best_indexes], function(x) x$par, 
                                                      ^

R/initialization.R:80:17: warning: no visible global function definition for ‘create_block’

return(list(create_block(basic_block)))
                ^~~~~~~~~~~~

R/initialization.R:82:1: style: Trailing whitespace is superfluous.

^~

R/initialization.R:90:45: warning: no visible global function definition for ‘create_block’

blocks[[(j - 1) * par_number + i]] <- create_block(new_block)
                                            ^~~~~~~~~~~~

R/initialization.R:93:1: style: Trailing whitespace is superfluous.

^~

R/initialization.R:98:1: style: lines should not be more than 80 characters.

do_zoom_in_search <- function(model, data, reps, sim, cores, sim_cache, block_width, 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/initialization.R:98:85: style: Trailing whitespace is superfluous.

do_zoom_in_search <- function(model, data, reps, sim, cores, sim_cache, block_width, 
                                                                                    ^

R/initialization.R:100:1: style: lines should not be more than 80 characters.

"Starts with estimating parameters in the complete parameter space, an then iteratively 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/initialization.R:100:90: style: Trailing whitespace is superfluous.

"Starts with estimating parameters in the complete parameter space, an then iteratively 
                                                                                         ^

R/initialization.R:109:1: style: Trailing whitespace is superfluous.

^~~~~~

R/initialization.R:111:17: warning: no visible global function definition for ‘estimate_local_ml’

middle <- estimate_local_ml(block, model, data, sim, cores, sim_cache)$par
                ^~~~~~~~~~~~~~~~~

R/initialization.R:112:1: style: Trailing whitespace is superfluous.

^~~~~~

R/initialization.R:117:3: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​  }, numeric(model$get_par_number())))
  ^

R/jaatha_data.R:2:44: style: Trailing whitespace is superfluous.

jaatha_data_class <- R6Class("jaatha_data", 
                                           ^

R/jaatha_data.R:16:57: style: Trailing whitespace is superfluous.

​          stop("Data has missing values for statistic ", 
                                                        ^

R/jaatha_data.R:26:9: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​        }, numeric(1))
        ^

R/jaatha_data.R:84:3: warning: no visible binding for global variable ‘jaatha_data_class’

jaatha_data_class$new(data, model)
  ^~~~~~~~~~~~~~~~~

R/jaatha_data.R:90:3: warning: no visible global function definition for ‘create_jaatha_data’

​  create_jaatha_data(test_data, model)
  ^~~~~~~~~~~~~~~~~~

R/jaatha_log.R:1:42: style: Trailing whitespace is superfluous.

jaatha_log_class <- R6Class("jaatha_log", 
                                         ^

R/jaatha_log.R:18:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha_log.R:26:1: style: lines should not be more than 80 characters.

private$final_estimates <- private$estimates[[1]][rep(1, 5 * par_number), ]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/jaatha_log.R:44:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha_log.R:47:76: style: Trailing whitespace is superfluous.

​        message(" Step ", step, ": Loglikelihood ", format(estimate$value), 
                                                                           ^

R/jaatha_log.R:50:66: style: Trailing whitespace is superfluous.

​        message(" Parameter: ", private$format_par(estimate$par), 
                                                                 ^

R/jaatha_log.R:51:53: style: Trailing whitespace is superfluous.

", Loglikelihood ", format(old_llh), 
                                                    ^

R/jaatha_log.R:57:36: style: Trailing whitespace is superfluous.

​        message("Repetition ", rep, 
                                   ^

R/jaatha_log.R:63:31: style: Use <-, not =, for assignment.

private$converged[step] = TRUE
                              ^

R/jaatha_log.R:67:60: style: Trailing whitespace is superfluous.

​      message("Determining starting positions using the '", 
                                                           ^

R/jaatha_log.R:88:45: style: Place a space before left parenthesis, except in a function call.

param <- as.numeric(best_estimate[1, -(1:3)])
                                            ^

R/jaatha_model.R:4:46: style: Trailing whitespace is superfluous.

jaatha_model_class <- R6Class("jaatha_model", 
                                             ^

R/jaatha_model.R:13:71: style: Trailing whitespace is superfluous.

​        stop("There already is a summary statistic with name '", name, 
                                                                      ^

R/jaatha_model.R:21:59: style: Trailing whitespace is superfluous.

initialize = function(sim_func, par_ranges, sum_stats, 
                                                          ^

R/jaatha_model.R:43:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha_model.R:46:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha_model.R:51:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:55:9: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​        }, error = function(e) {
        ^

R/jaatha_model.R:56:22: style: Use <-, not =, for assignment.

error_dump = tempfile("jaatha_frame_dump_", fileext = ".Rda")
                     ^

R/jaatha_model.R:59:76: style: Trailing whitespace is superfluous.

​          stop(paste(e$message, "[Frame dump written to", error_dump, "]"), 
                                                                           ^

R/jaatha_model.R:62:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:63:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:68:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:72:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:74:7: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​      }, mc.preschedule = !private$slow_sim, mc.cores = cores)
      ^

R/jaatha_model.R:75:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha_model.R:83:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:93:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha_model.R:97:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:100:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/jaatha_model.R:103:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha_model.R:134:1: style: lines should not be more than 80 characters.

create_jaatha_model.default <- function(x, ..., scaling_factor = 1, test = TRUE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/jaatha_model.R:167:61: style: Trailing whitespace is superfluous.

scaling_factor = 1, 
                                                            ^

R/jaatha_model.R:169:51: style: Trailing whitespace is superfluous.

jaatha_model_class$new(x, par_ranges, sum_stats, 
                                                  ^

R/jaatha.R:64:32: style: Trailing whitespace is superfluous.

jaatha <- function(model, data, 
                               ^

R/jaatha.R:65:36: style: Trailing whitespace is superfluous.

repetitions = 3, 
                                   ^

R/jaatha.R:66:54: style: Trailing whitespace is superfluous.

sim = model$get_par_number() * 25, 
                                                     ^

R/jaatha.R:67:36: style: Trailing whitespace is superfluous.

max_steps = 100, 
                                   ^

R/jaatha.R:68:64: style: Trailing whitespace is superfluous.

init_method = c("zoom-in", "initial-search", 
                                                               ^

R/jaatha.R:74:1: style: Trailing whitespace is superfluous.

^~

R/jaatha.R:76:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is_jaatha_model(model))
  ^~~~~~~~~~~

R/jaatha.R:76:15: warning: no visible global function definition for ‘is_jaatha_model’

​  assert_that(is_jaatha_model(model))
              ^~~~~~~~~~~~~~~

R/jaatha.R:77:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is_jaatha_data(data))
  ^~~~~~~~~~~

R/jaatha.R:77:15: warning: no visible global function definition for ‘is_jaatha_data’

​  assert_that(is_jaatha_data(data))
              ^~~~~~~~~~~~~~

R/jaatha.R:78:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.count(repetitions))
  ^~~~~~~~~~~

R/jaatha.R:78:15: warning: no visible global function definition for ‘is.count’

​  assert_that(is.count(repetitions))
              ^~~~~~~~

R/jaatha.R:79:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.count(sim))
  ^~~~~~~~~~~

R/jaatha.R:79:15: warning: no visible global function definition for ‘is.count’

​  assert_that(is.count(sim))
              ^~~~~~~~

R/jaatha.R:80:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.count(cores))
  ^~~~~~~~~~~

R/jaatha.R:80:15: warning: no visible global function definition for ‘is.count’

​  assert_that(is.count(cores))
              ^~~~~~~~

R/jaatha.R:81:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.numeric(block_width) && length(block_width) == 1)
  ^~~~~~~~~~~

R/jaatha.R:82:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(block_width > 0 && block_width < 1)
  ^~~~~~~~~~~

R/jaatha.R:83:1: style: Trailing whitespace is superfluous.

^~

R/jaatha.R:85:10: warning: no visible global function definition for ‘create_jaatha_log’

log <- create_jaatha_log(model, data, repetitions, max_steps, verbose = TRUE)
         ^~~~~~~~~~~~~~~~~

R/jaatha.R:87:16: warning: no visible global function definition for ‘create_sim_cache’

sim_cache <- create_sim_cache(sim_cache_limit)
               ^~~~~~~~~~~~~~~~

R/jaatha.R:89:1: style: Trailing whitespace is superfluous.

^~

R/jaatha.R:94:1: style: Trailing whitespace is superfluous.

^~

R/jaatha.R:100:1: style: Trailing whitespace is superfluous.

^~~~

R/jaatha.R:103:64: style: Trailing whitespace is superfluous.

estimate + block_width * .5), 
                                                               ^

R/jaatha.R:105:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha.R:106:19: warning: no visible global function definition for ‘estimate_local_ml’

local_ml <- estimate_local_ml(block, model, data, sim, cores, sim_cache)
                  ^~~~~~~~~~~~~~~~~

R/jaatha.R:113:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha.R:118:1: style: Trailing whitespace is superfluous.

^~~~~~

R/jaatha.R:125:1: style: Trailing whitespace is superfluous.

^~

R/jaatha.R:131:65: style: Place a space before left parenthesis, except in a function call.

llh <- estimate_llh(model, data, as.numeric(best_values[i, -(1:3)]), 
                                                                ^

R/jaatha.R:131:73: style: Trailing whitespace is superfluous.

llh <- estimate_llh(model, data, as.numeric(best_values[i, -(1:3)]), 
                                                                        ^

R/jaatha.R:135:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:1:52: style: Trailing whitespace is superfluous.

calc_poisson_llh <- function(data, stat, loglambda, 
                                                   ^

R/likelihood.R:3:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:7:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:10:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:11:49: style: Trailing whitespace is superfluous.

llh <- sum(data$get_values(stat) * loglambda - 
                                                ^

R/likelihood.R:13:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:14:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.finite(llh))
  ^~~~~~~~~~~

R/likelihood.R:25:75: style: Opening curly braces should never go on their own line and should always be followed by a new line.

approximate_llh.default <- function(x, data, param, glm_fitted, sim, ...) { 
                                                                          ^

R/likelihood.R:25:76: style: Trailing whitespace is superfluous.

approximate_llh.default <- function(x, data, param, glm_fitted, sim, ...) { 
                                                                           ^

R/likelihood.R:32:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is_jaatha_data(data))
  ^~~~~~~~~~~

R/likelihood.R:32:15: warning: no visible global function definition for ‘is_jaatha_data’

​  assert_that(is_jaatha_data(data))
              ^~~~~~~~~~~~~~

R/likelihood.R:33:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.numeric(param))
  ^~~~~~~~~~~

R/likelihood.R:34:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.list(glm_fitted))
  ^~~~~~~~~~~

R/likelihood.R:42:1: style: Variable and function names should not be longer than 30 characters.

approximate_llh.jaatha_stat_basic  <- function(x, data, param, glm_fitted, 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/likelihood.R:42:75: style: Trailing whitespace is superfluous.

approximate_llh.jaatha_stat_basic  <- function(x, data, param, glm_fitted, 
                                                                          ^

R/likelihood.R:44:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:47:3: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​  }, numeric(1))
  ^

R/likelihood.R:48:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:50:3: warning: no visible global function definition for ‘calc_poisson_llh’

​  calc_poisson_llh(data, x, loglambda, sim, scaling_factor)
  ^~~~~~~~~~~~~~~~

R/likelihood.R:59:25: warning: no visible global function definition for ‘approximate_llh’

​                        approximate_llh(model, data, param, glms, sim)
                        ^~~~~~~~~~~~~~~

R/likelihood.R:61:41: style: Commas should never have a space before.

lower = boundary[ , 1, drop = FALSE], 
                                       ~^

R/likelihood.R:61:60: style: Trailing whitespace is superfluous.

lower = boundary[ , 1, drop = FALSE], 
                                                           ^

R/likelihood.R:62:41: style: Commas should never have a space before.

upper = boundary[ , 2, drop = FALSE],
                                       ~^

R/likelihood.R:63:43: style: Trailing whitespace is superfluous.

method = "L-BFGS-B", 
                                          ^

R/likelihood.R:65:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:66:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(block$includes(best_value$par))
  ^~~~~~~~~~~

R/likelihood.R:73:68: style: Trailing whitespace is superfluous.

sim_data <- model$simulate(pars = block$sample_pars(sim, TRUE), 
                                                                   ^

R/likelihood.R:75:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:79:5: warning: no visible global function definition for ‘assert_that’

​    assert_that(length(sim_data) >= sim)
    ^~~~~~~~~~~

R/likelihood.R:80:1: style: Trailing whitespace is superfluous.

^~~~

R/likelihood.R:82:22: warning: no visible global function definition for ‘fit_glm’

glms <- tryCatch(fit_glm(model, sim_data), error = identity)
                     ^~~~~~~

R/likelihood.R:83:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:87:1: style: Trailing whitespace is superfluous.

^~~~

R/likelihood.R:91:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:92:3: warning: no visible global function definition for ‘optimize_llh’

​  optimize_llh(block, model, data, glms, length(sim_data))
  ^~~~~~~~~~~~

R/likelihood.R:115:60: style: Trailing whitespace is superfluous.

estimate_llh <- function(model, data, parameter, sim = 100, 
                                                           ^

R/likelihood.R:117:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:118:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is_jaatha_model(model))
  ^~~~~~~~~~~

R/likelihood.R:118:15: warning: no visible global function definition for ‘is_jaatha_model’

​  assert_that(is_jaatha_model(model))
              ^~~~~~~~~~~~~~~

R/likelihood.R:119:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is_jaatha_data(data))
  ^~~~~~~~~~~

R/likelihood.R:119:15: warning: no visible global function definition for ‘is_jaatha_data’

​  assert_that(is_jaatha_data(data))
              ^~~~~~~~~~~~~~

R/likelihood.R:120:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.numeric(parameter))
  ^~~~~~~~~~~

R/likelihood.R:121:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.count(sim))
  ^~~~~~~~~~~

R/likelihood.R:121:15: warning: no visible global function definition for ‘is.count’

​  assert_that(is.count(sim))
              ^~~~~~~~

R/likelihood.R:122:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.count(cores))
  ^~~~~~~~~~~

R/likelihood.R:122:15: warning: no visible global function definition for ‘is.count’

​  assert_that(is.count(cores))
              ^~~~~~~~

R/likelihood.R:123:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is_single_logical(normalized))
  ^~~~~~~~~~~

R/likelihood.R:123:15: warning: no visible global function definition for ‘is_single_logical’

​  assert_that(is_single_logical(normalized))
              ^~~~~~~~~~~~~~~~~

R/likelihood.R:124:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:135:5: warning: no visible global function definition for ‘calc_poisson_llh’

​    calc_poisson_llh(data, stat, log_means, sim, model$get_scaling_factor())
    ^~~~~~~~~~~~~~~~

R/likelihood.R:136:3: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

​  }, numeric(1)))
  ^

R/likelihood.R:137:1: style: Trailing whitespace is superfluous.

^~

R/likelihood.R:138:3: warning: no visible global function definition for ‘assert_that’

​  assert_that(is.finite(llh))
  ^~~~~~~~~~~

R/par_ranges.R:2:42: style: Trailing whitespace is superfluous.

par_ranges_class <- R6Class("par_ranges", 
                                         ^

R/par_ranges.R:13:32: style: Do not place spaces around code in parentheses or square brackets.

​      assert_that(all(par_range[ , 1] < par_range[ , 2]))
                               ^

R/par_ranges.R:14:34: style: Commas should never have a space before.

​      assert_that(all(par_range[ , 1] < par_range[ , 2]))
                                ~^

R/par_ranges.R:14:52: style: Commas should never have a space before.

​      assert_that(all(par_range[ , 1] < par_range[ , 2]))
                                                  ~^

R/par_ranges.R:21:53: style: Commas should never have a space before.

private$log_range_width <- private$log_range[ , 2] - 
                                                   ~^

R/par_ranges.R:21:59: style: Trailing whitespace is superfluous.

private$log_range_width <- private$log_range[ , 2] - 
                                                          ^

R/par_ranges.R:22:55: style: Commas should never have a space before.

private$log_range[ , 1]
                                                     ~^

Please sign in to comment.