Skip to content

Commit

Permalink
avoid duplicates in standata
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorDonegan committed Oct 20, 2023
1 parent 9c1c030 commit 9408152
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 117 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ cran-comments.md
^CRAN-RELEASE$
^doc$
^Meta$
^CRAN-SUBMISSION$
9 changes: 8 additions & 1 deletion R/stan_car.R
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ stan_car <- function(formula,
y = y,
y_int = y_int,
trials = rep(0, length(y)),
n = n,
#n = n, # getting n from car_parts, below
input_offset = offset,
has_re = has_re,
n_ids = n_ids,
Expand Down Expand Up @@ -381,7 +381,14 @@ stan_car <- function(formula,
standata <- c(standata, empty_icar_data(n), empty_esf_data(n), empty_sar_data(n))
## ME MODEL -------------
me.list <- make_me_data(ME, xraw)

# remove ME-car parts: othwerise, they duplicate the car_parts argument
duplicates <- c("n", "nC", "nAx_w", "C", "Delta_inv", "log_det_Delta_inv", "Ax_w", "Ax_v", "Ax_u", "Cidx", "lambda", "WCAR")
me.list[which(names(me.list) %in% duplicates)] <- NULL

# append me.list to standata
standata <- c(standata, me.list)

## INTEGER OUTCOMES -------------
if (family$family == "binomial") {
standata$y <- standata$y_int <- y[,1]
Expand Down
4 changes: 2 additions & 2 deletions R/stan_sar.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ stan_sar <- function(formula,
y = y,
y_int = y_int,
trials = rep(0, length(y)),
n = n,
#n = n, # getting n from sar_parts, below
input_offset = offset,
has_re = has_re,
n_ids = n_ids,
id = id_index$idx,
center_x = centerx, ####////!!!!####
center_x = centerx,
## slx data -------------
W_w = as.array(W.list$w),
W_v = as.array(W.list$v),
Expand Down
114 changes: 0 additions & 114 deletions tests/testthat/test-stan-sar.R~

This file was deleted.

0 comments on commit 9408152

Please sign in to comment.