Skip to content

Commit 70b9681

Browse files
committed
check intercept
1 parent 4f68f6e commit 70b9681

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ importFrom(stats,median)
1111
importFrom(stats,model.matrix)
1212
importFrom(stats,quantile)
1313
importFrom(stats,rchisq)
14+
importFrom(stats,terms.formula)
1415
importFrom(utils,combn)

Diff for: R/main.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#' @export
2626
#' @importFrom SIS SIS
2727
#' @importFrom lazyeval f_eval_lhs
28-
#' @importFrom stats model.matrix rchisq
28+
#' @importFrom stats model.matrix rchisq terms.formula
2929
#' @importFrom mvtnorm rmvnorm
3030
#'
3131
#' @examples # data ####
@@ -48,6 +48,12 @@
4848
gfiUltra <- function(
4949
formula, data, nsims = 1000L, verbose = FALSE, gamma = 1, ...
5050
){
51+
intercept <- attr(terms.formula(formula, data = data), "intercept")
52+
if(intercept == 0L){
53+
stop(
54+
"The formula must include the intercept."
55+
)
56+
}
5157
y <- f_eval_lhs(formula, data = data)
5258
X <- model.matrix(formula, data = data)
5359
n <- length(y)

0 commit comments

Comments
 (0)