Skip to content

Commit

Permalink
minor cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Dec 22, 2016
1 parent 1d2dbd4 commit 350bedc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions R/brmsformula.R
Expand Up @@ -29,6 +29,7 @@
#' of the \code{exgaussian} family);
#' \code{zi} (zero-inflation probability);
#' \code{hu} (hurdle probability);
#' \code{disc} (discrimination) for ordinal models;
#' \code{bs}, \code{ndt}, and \code{bias} (boundary separation,
#' non-decision time, and initial bias of the \code{wiener}
#' diffusion model).
Expand Down Expand Up @@ -402,12 +403,12 @@ brmsformula <- function(formula, ..., nonlinear = NULL) {
attr(dots[[i]], "par") <- NULL
}
if (any(!nzchar(names(dots)))) {
stop("'brmsformula' requires named arguments.", call. = FALSE)
stop2("'brmsformula' requires named arguments.")
}
invalid_names <- setdiff(names(dots), auxpars())
if (length(invalid_names)) {
stop("The following argument names were invalid: ",
paste(invalid_names, collapse = ", "), call. = FALSE)
stop2("The following argument names were invalid: ",
paste(invalid_names, collapse = ", "))
}
# add attributes to formula
if (is.logical(attr(formula, "nonlinear"))) {
Expand Down
8 changes: 4 additions & 4 deletions R/stan-helpers.R
Expand Up @@ -485,9 +485,9 @@ stan_ordinal <- function(family, prior = brmsprior(),
sign <- ifelse(fam %in% c("cumulative", "sratio"), " - ", " + ")
ptl <- ifelse(cs, paste0(sign, "etacs[k]"), "")
if (sign == " - ") {
out <- paste0("thres[",k,"]", ptl, " - eta")
out <- paste0("thres[", k, "]", ptl, " - eta")
} else {
out <- paste0("eta", ptl, " - thres[",k,"]")
out <- paste0("eta", ptl, " - thres[", k, "]")
}
paste0("disc * (", out, ")")
}
Expand Down Expand Up @@ -541,8 +541,8 @@ stan_ordinal <- function(family, prior = brmsprior(),
out$fun <- paste0(out$fun,
" p[1] = ", ilink, "(", th(1), "); \n",
" for (k in 2:(ncat - 1)) { \n",
" p[k] = ", ilink, "(", th("k"), ") - ",
ilink, "(", th("k - 1"), "); \n",
" p[k] = ", ilink, "(", th("k"), ") - \n",
" ", ilink, "(", th("k - 1"), "); \n",
" } \n",
" p[ncat] = 1 - ",ilink, "(", th("ncat - 1"), "); \n")
} else if (family %in% c("sratio", "cratio")) {
Expand Down
1 change: 1 addition & 0 deletions man/brmsformula.Rd

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

0 comments on commit 350bedc

Please sign in to comment.