Skip to content

Commit 4e50c4d

Browse files
committed
Fixed a small bug in fs function. Seems have been introduced when this function was modified notationally. The least squares solution was not being returned properly; now it is.
1 parent 427e89c commit 4e50c4d

File tree

7 files changed

+17
-20
lines changed

7 files changed

+17
-20
lines changed

selectiveInference/DESCRIPTION

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Depends:
1212
survival
1313
Suggests:
1414
Rmpfr
15-
Description: New tools for post-selection inference, for use
16-
with forward stepwise regression, least angle regression, the
17-
lasso, and the many means problem. The lasso function implements Gaussian, logistic and Cox survival models.
15+
Description: New tools for post-selection inference, for use with forward
16+
stepwise regression, least angle regression, the lasso, and the many means
17+
problem. The lasso function implements Gaussian, logistic and Cox survival
18+
models.
1819
License: GPL-2
20+
RoxygenNote: 5.0.1

selectiveInference/R/funs.fs.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ fs <- function(x, y, maxsteps=2000, intercept=TRUE, normalize=TRUE,
106106
}
107107

108108
# Key quantities for the next entry
109-
keepLs=backsolve(R,t(Q_active)%*%X_inactive)
110-
X_inactive_resid = X_inactive - X_active %*% keepLs
109+
keepLs = backsolve(R,t(Q_active)%*%y)
110+
X_inactive_resid = X_inactive - X_active %*% backsolve(R,t(Q_active)%*%X_inactive)
111111
working_x = scale(X_inactive_resid,center=F,scale=sqrt(colSums(X_inactive_resid^2)))
112112
score = as.numeric(t(working_x)%*%y)
113113

@@ -127,7 +127,7 @@ fs <- function(x, y, maxsteps=2000, intercept=TRUE, normalize=TRUE,
127127

128128
action[k] = I[i_hit]
129129
df[k] = r
130-
beta[A,k] = backsolve(R,t(Q_active)%*%y)
130+
beta[A,k] = keepLs
131131

132132
# Gamma matrix!
133133
if (gi + 2*p > nrow(Gamma)) Gamma = rbind(Gamma,matrix(0,2*p+gbuf,n))
@@ -188,8 +188,7 @@ fs <- function(x, y, maxsteps=2000, intercept=TRUE, normalize=TRUE,
188188

189189
# Record the least squares solution. Note that
190190
# we have already computed this
191-
bls = rep(0,p)
192-
if(length(keepLs)>0) bls[A] = keepLs
191+
bls = rep(0,p); bls[A] = keepLs
193192
}
194193

195194
if (verbose) cat("\n")

selectiveInference/man/factorDesign.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

selectiveInference/man/groupfs.Rd

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

selectiveInference/man/groupfsInf.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

selectiveInference/man/predict.groupfs.Rd

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

selectiveInference/man/scaleGroups.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)