Skip to content

Commit

Permalink
Enable an intercept in the beta initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Sep 4, 2024
1 parent 78a2116 commit 30c4b2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/surreal.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ find_X_y_core <- function(y_hat, R_0, R_squared = 0.3, p = 5, max_iter = 100, to
y_hat <- sd(R_0) / sd(y_hat) * sqrt(R_squared / (1 - R_squared)) * y_hat

# Initialize parameters
beta <- c(0, seq_len(p)) # beta_0 and beta_{1:p} combined
beta <- c(1, seq_len(p)) # beta_0 and beta_{1:p} combined
j_star <- p + 1 # Adjusting for 1-based indexing in R

# Generate random noise
Expand Down Expand Up @@ -173,7 +173,7 @@ find_X_y_core <- function(y_hat, R_0, R_squared = 0.3, p = 5, max_iter = 100, to
#'
#' @examples
#' # Generate a 2D data set
#' data <- cbind(y = rnorm(100), x = rnorm(100))
#' data <- cbind(y_hat = rnorm(100), R_0 = rnorm(100))
#'
#' # Display original data
#' plot(data, pch = 16, main = "Original data")
Expand Down
2 changes: 1 addition & 1 deletion man/surreal.Rd

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

0 comments on commit 30c4b2a

Please sign in to comment.