Skip to content

Commit

Permalink
0.2.1:
Browse files Browse the repository at this point in the history
	Bug correction: handles special case where one predictor is identical with target variable.
  • Loading branch information
lingfeiwang committed Dec 3, 2019
1 parent c05e689 commit 96ffd6e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions UPDATES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.2.1:
Bug correction: handle special cases where one predictor is identical with target variable.
0.2.0:
Added an additional null distribution: spherical, besides the original normal distribution. This can be set in the new H0 parameter. For details, see reference.
Corrected normalize=FALSE cases.
Expand Down
6 changes: 3 additions & 3 deletions lassopv/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: lassopv
Type: Package
Title: Nonparametric P-Value Estimation for Predictors in Lasso
Version: 0.2.0
Date: 2018-02-22
Version: 0.2.1
Date: 2019-12-03
Author: Lingfei Wang <[email protected]>
Maintainer: Lingfei Wang <[email protected]>
Description: Estimate the p-values for predictors x against target variable y in lasso regression, using the regularization strength when each predictor enters the active set of regularization path for the first time as the statistic. This is based on the assumption that predictors (of the same variance) that (first) become active earlier tend to be more significant. Three null distributions are supported: normal and spherical, which are computed separately for each predictor and analytically under approximation, which aims at efficiency and accuracy for small p-values.
URL: https://github.com/lingfeiwang/lassopv
License: GPL-3
Copyright: Copyright 2016-2018 Lingfei Wang
Copyright: Copyright 2016-2019 Lingfei Wang
Depends: R (>= 2.10)
Imports: lars, stats
NeedsCompilation: no
11 changes: 9 additions & 2 deletions lassopv/R/lassopv.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2018 Lingfei Wang
# Copyright 2016-2019 Lingfei Wang
#
# This file is part of lassopv.
#
Expand Down Expand Up @@ -54,7 +54,12 @@ lassopv<-function (x,y,normalize=TRUE,H0=c("spherical","normal"),log.p=FALSE,max
#lambda values
lambda=a$lambda[1:nstep,drop=F]/ds
#Residue
yres=y-predict.lars(a,x,s=a$lambda[1:nstep,drop=F],mode='lambda')$fit
ypredict=predict.lars(a,x,s=a$lambda[1:nstep,drop=F],mode='lambda')$fit
if(is.null(dim(ypredict)))
{
ypredict=matrix(ypredict,ncol=1)
}
yres=y-ypredict
#Residue variance
pv=t(t(yres)-colMeans(yres))
pv=colMeans(pv**2)
Expand Down Expand Up @@ -97,12 +102,14 @@ lassopv<-function (x,y,normalize=TRUE,H0=c("spherical","normal"),log.p=FALSE,max
if(log.p)
{
ans[!isdone]=0
ans[is.nan(ans)]=-Inf
#Account for numerical precision limitations
ans[ans>0]=0
}
else
{
ans[!isdone]=1
ans[is.nan(ans)]=0
#Account for numerical precision limitations
ans[ans>1]=1
}
Expand Down

0 comments on commit 96ffd6e

Please sign in to comment.