Skip to content

Commit

Permalink
matrix x dimension drop issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yshin12 committed Oct 31, 2023
1 parent be1105f commit 5bfb4c4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/sgd_lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sgd_lm = function(formula,
mf <- eval(mf, parent.frame())
mt <- attr(mf, "terms")
y <- model.response(mf, "numeric")
x <- model.matrix(mt, mf)[,-1]
x <- as.matrix(model.matrix(mt, mf, drop=F)[,-1])

if (studentize){
# Compute column means and standard errors and save them for later reconversion
Expand Down
2 changes: 1 addition & 1 deletion R/sgd_qr.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sgd_qr = function(formula,
mf <- eval(mf, parent.frame())
mt <- attr(mf, "terms")
y <- model.response(mf, "numeric")
x <- model.matrix(mt, mf)[,-1]
x <- as.matrix(model.matrix(mt, mf, drop=F)[,-1])

if (studentize){
# Compute column means and standard errors and save them for later reconversion
Expand Down
2 changes: 1 addition & 1 deletion R/sgdi_qr.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ sgdi_qr = function(formula,
mf <- eval(mf, parent.frame())
mt <- attr(mf, "terms")
y <- model.response(mf, "numeric")
x <- model.matrix(mt, mf)[,-1]
x <- as.matrix(model.matrix(mt, mf, drop=F)[,-1])
if (inference == "rss"){
if (0 %in% rss_idx ){
stop("rss_idx includes 0 (the intercept term), where it should be bigger than 1.")
Expand Down

0 comments on commit 5bfb4c4

Please sign in to comment.