Skip to content

Commit

Permalink
stan_glm.fit.R: do not offset by -1L anymore
Browse files Browse the repository at this point in the history
this was due to using Stan's csr_ function rather than our C++ function to emulate it
  • Loading branch information
bgoodri committed Mar 15, 2022
1 parent 44b87a4 commit 3c08d53
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions R/stan_glm.fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,16 @@ stan_glm.fit <-
standata$num_non_zero <- c(length(parts0$w), length(parts1$w))
standata$w0 <- as.array(parts0$w)
standata$w1 <- as.array(parts1$w)
standata$v0 <- as.array(parts0$v - 1L)
standata$v1 <- as.array(parts1$v - 1L)
standata$u0 <- as.array(parts0$u - 1L)
standata$u1 <- as.array(parts1$u - 1L)
standata$v0 <- as.array(parts0$v)
standata$v1 <- as.array(parts1$v)
standata$u0 <- as.array(parts0$u)
standata$u1 <- as.array(parts1$u)
} else {
parts <- extract_sparse_parts(Z)
standata$num_non_zero <- length(parts$w)
standata$w <- parts$w
standata$v <- parts$v - 1L
standata$u <- parts$u - 1L
standata$v <- parts$v
standata$u <- parts$u
}
standata$shape <- as.array(maybe_broadcast(decov$shape, t))
standata$scale <- as.array(maybe_broadcast(decov$scale, t))
Expand Down Expand Up @@ -439,8 +439,8 @@ stan_glm.fit <-
parts <- extract_sparse_parts(xtemp)
standata$nnz_X <- length(parts$w)
standata$w_X <- parts$w
standata$v_X <- parts$v - 1L
standata$u_X <- parts$u - 1L
standata$v_X <- parts$v
standata$u_X <- parts$u
standata$X <- array(0, dim = c(0L, dim(xtemp)))
} else {
standata$X <- array(xtemp, dim = c(1L, dim(xtemp)))
Expand Down Expand Up @@ -482,13 +482,13 @@ stan_glm.fit <-
parts0 <- extract_sparse_parts(xtemp[y0, , drop = FALSE])
standata$nnz_X0 <- length(parts0$w)
standata$w_X0 = parts0$w
standata$v_X0 = parts0$v - 1L
standata$u_X0 = parts0$u - 1L
standata$v_X0 = parts0$v
standata$u_X0 = parts0$u
parts1 <- extract_sparse_parts(xtemp[y1, , drop = FALSE])
standata$nnz_X1 <- length(parts1$w)
standata$w_X1 = parts1$w
standata$v_X1 = parts1$v - 1L
standata$u_X1 = parts1$u - 1L
standata$v_X1 = parts1$v
standata$u_X1 = parts1$u
} else {
standata$X0 <- array(xtemp[y0, , drop = FALSE], dim = c(1, sum(y0), ncol(xtemp)))
standata$X1 <- array(xtemp[y1, , drop = FALSE], dim = c(1, sum(y1), ncol(xtemp)))
Expand Down

0 comments on commit 3c08d53

Please sign in to comment.