Skip to content

Fixed handling of numeric variables in factorDesign #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 455 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
455 commits
Select commit Hold shift + click to select a range
e87d12d
removed print statement
jonathan-taylor Aug 16, 2017
210d0fe
using C for each row
jonathan-taylor Aug 16, 2017
c7c41e4
optimized the C code a bit -- still has debug statements
jonathan-taylor Aug 16, 2017
f6ae738
removing debug statements, making objective computation faster
jonathan-taylor Aug 16, 2017
2bd33e8
Merge pull request #18 from jonathan-taylor/master
tibshirani Aug 16, 2017
1a8e2ad
slightly lower tolerance
jonathan-taylor Aug 16, 2017
c391bd3
using active sets
jonathan-taylor Aug 16, 2017
096b0b8
begun the Rcpp extension
jonathan-taylor Aug 17, 2017
faf0436
trying to save some copy time -- R doesn't seem to care about extra a…
jonathan-taylor Aug 17, 2017
5bf8018
don't lose this
jonathan-taylor Aug 17, 2017
944ae7d
segfaulting on the test_big.R :(
jonathan-taylor Aug 17, 2017
4caf225
changes to funs.fixed.R that will be overwritten
jonathan-taylor Aug 17, 2017
f53af23
success -- about 2ms now -- python still faster (as timed through rpy…
jonathan-taylor Aug 17, 2017
7920c8c
BF: column major, removing print statements
jonathan-taylor Aug 17, 2017
6756ab2
changing name of function, evaluation of feasibility in Rcpp
jonathan-taylor Aug 17, 2017
0e58435
RF: renamed C function, removing R solver for one row
jonathan-taylor Aug 17, 2017
0614305
need to make Rcpp exports
jonathan-taylor Aug 17, 2017
ca60bc9
ignore first two lines if status not OK?
jonathan-taylor Aug 17, 2017
60f6cde
install Rcpp earlier
jonathan-taylor Aug 17, 2017
c1aef63
using Rcpp for matrixcomps as well -- update1 and downdate1 -- exampl…
jonathan-taylor Aug 17, 2017
f468510
using a warm start if available
jonathan-taylor Aug 17, 2017
a8805b8
trying to find segfault
jonathan-taylor Aug 18, 2017
abf0351
BF: order of arguments to is_active, renamed the function as well
jonathan-taylor Aug 18, 2017
27af0d5
removing debug statements
jonathan-taylor Aug 18, 2017
3a46ad8
not using the C code
jonathan-taylor Aug 18, 2017
de103f7
removing useC
jonathan-taylor Aug 18, 2017
d487526
BF: percent signs in example
jonathan-taylor Aug 18, 2017
7360386
smaller changes in mu per step in line search
jonathan-taylor Aug 18, 2017
a9a8bbb
renaming Sigma_theta to gradient, making sure we loop through active set
jonathan-taylor Aug 18, 2017
7f1e4a6
more renaming
jonathan-taylor Aug 18, 2017
a4055ce
BF: forgot to rename in Rcpp file, passing active and ever_active from R
jonathan-taylor Aug 18, 2017
f432b42
more renaming
jonathan-taylor Aug 18, 2017
fcd8206
trying to get arbitrary linfunc
jonathan-taylor Aug 18, 2017
a67d29f
can solve arbitrary LASSO now
jonathan-taylor Aug 18, 2017
d248a8f
BF: updating active set
jonathan-taylor Aug 18, 2017
aa515c9
cosmetic change
jonathan-taylor Aug 18, 2017
5d5e8f3
BF: fixing function signatures
jonathan-taylor Aug 18, 2017
d1debcd
BF: fixing function signatures
jonathan-taylor Aug 18, 2017
15762af
BF: KKT wrong for active conditions, still have debug statements
jonathan-taylor Aug 18, 2017
9872b45
removing debug statements
jonathan-taylor Aug 18, 2017
be84df2
BF: KKT condition was wrong
jonathan-taylor Aug 18, 2017
0de59af
lenient tolerance
jonathan-taylor Aug 18, 2017
190c0a0
added a few targets to makefile
jonathan-taylor Aug 18, 2017
2c4cf3a
not checking objective
jonathan-taylor Aug 18, 2017
9ebcaab
making Rcpp in Makevars now
jonathan-taylor Aug 19, 2017
735c4d6
trying without making Rcpp
jonathan-taylor Aug 19, 2017
0865d09
making new quadratic_program C file
jonathan-taylor Aug 19, 2017
bfad505
need to make Rcpp for travis
jonathan-taylor Aug 19, 2017
d65e437
BF: everything was thrown into active set
jonathan-taylor Aug 19, 2017
1237c78
both solvers working
jonathan-taylor Aug 19, 2017
3405f23
passing tol as argument; both solvers agree
jonathan-taylor Aug 20, 2017
8c956f8
making a choice for solver
jonathan-taylor Aug 20, 2017
93a9602
RF: ever_active is now 1-based indices to be more R like
jonathan-taylor Aug 20, 2017
b127083
added an argument to limit the number of times the linesearch runs
jonathan-taylor Aug 20, 2017
acbf82c
making it 10 tries as before
jonathan-taylor Aug 20, 2017
6dc80be
Merge pull request #26 from jonathan-taylor/using_Rcpp
jonathan-taylor Aug 21, 2017
3383e31
merging with upstream/master
jonathan-taylor Aug 29, 2017
7fa5120
NF: stop early if active set gets too big
jonathan-taylor Aug 29, 2017
0c1f9ea
renaming function, but all linesearch logic into a row-wise function
jonathan-taylor Aug 30, 2017
e292429
camel case function name (ew... but consistent)
jonathan-taylor Aug 30, 2017
ec07564
new export debiasingMatrix
jonathan-taylor Aug 30, 2017
3c0ef8d
minor edit
jonathan-taylor Aug 30, 2017
d94d217
BF: latex percent
jonathan-taylor Aug 30, 2017
3e9d62d
a little more doc
jonathan-taylor Aug 30, 2017
bbf7e19
Merge pull request #27 from jonathan-taylor/max_active
jonathan-taylor Aug 30, 2017
3c3d868
merging with upstream master
jonathan-taylor Aug 30, 2017
3d8b248
exporting function to construct polyhedral constraints of LASSO
jonathan-taylor Aug 31, 2017
d935d94
removing unused C code
jonathan-taylor Aug 31, 2017
7004a0b
moving file back
jonathan-taylor Aug 31, 2017
5e671a4
Rcpp exports
jonathan-taylor Sep 1, 2017
a0034d7
Merge pull request #29 from jonathan-taylor/master
jonathan-taylor Sep 11, 2017
0850c5a
Merge branch 'master' into export_lasso_poly
jonathan-taylor Sep 11, 2017
f4f448e
unexporting fixedLassoPoly
jonathan-taylor Sep 11, 2017
f0010f3
changing signs in arguments to TG.limits
jonathan-taylor Sep 11, 2017
7040ad4
copy of CRAN version 1.2.3 in selectiveInference-currentCRAN
jonathan-taylor Sep 22, 2017
0a3bc8d
new versions of RcppExports
jonathan-taylor Sep 22, 2017
5a0884b
Merge pull request #28 from jonathan-taylor/export_lasso_poly
jonathan-taylor Sep 25, 2017
59e9c7e
fixing examples for new glmnet, small cleanup of function signature
jonathan-taylor Sep 26, 2017
41dc63a
removing a tab
jonathan-taylor Sep 26, 2017
86a92fd
WIP: writing a solver for wide X matrices
jonathan-taylor Sep 26, 2017
2f05bf6
for devel version -- needs intervals reinstalled
jonathan-taylor Sep 26, 2017
48547ea
Merge pull request #30 from jonathan-taylor/master
jonathan-taylor Sep 26, 2017
6238a92
WIP: working on wide X QP
jonathan-taylor Sep 26, 2017
dd30abc
WIP: builds now, but segfaulting
jonathan-taylor Sep 26, 2017
ed19c29
test script for wide problem
jonathan-taylor Sep 26, 2017
ce0dc07
test running now -- no segfault?
jonathan-taylor Sep 26, 2017
c26a06b
WIP: running but not agreeing with other solver
jonathan-taylor Sep 27, 2017
bf65665
WIP: C code for wide version working -- need to work on R code
jonathan-taylor Sep 28, 2017
f85a568
test of wide solver
jonathan-taylor Sep 28, 2017
636483b
removing unneeded test, adding Rcpp exports
jonathan-taylor Sep 28, 2017
4d376c4
added R code decision for wide or not; R check passing
jonathan-taylor Sep 28, 2017
fb7f85f
solving active problem more accurately with more iterations -- KKT ch…
jonathan-taylor Sep 28, 2017
76f3e7e
R code now produces almost identical answer when assuming wide or not
jonathan-taylor Sep 28, 2017
726b917
Merge pull request #31 from jonathan-taylor/wide_matrix_QP
tibshirani Sep 29, 2017
c0dab8c
rob fixed type=full option
tibshirani Oct 4, 2017
ae37fdc
rob type=full
tibshirani Oct 4, 2017
8f356ff
rob fixed another type=full bug
tibshirani Oct 4, 2017
782290e
small change to current CRAN
tibshirani Oct 4, 2017
96e87ab
travis failing with install for shell reason -- maybe caps works better?
jonathan-taylor Sep 9, 2017
9d54c53
Merge remote-tracking branch 'upstream'
jonathan-taylor Oct 10, 2017
be257f1
small cleanup of fixedLassoPoly
jonathan-taylor Oct 10, 2017
25dce24
rewriting fixedLassoPoly to allow for vector lambda (including unpena…
jonathan-taylor Oct 10, 2017
17eaff4
undefined reference to n
jonathan-taylor Oct 10, 2017
eb2a5e4
needed LaTeX escape chars
jonathan-taylor Oct 10, 2017
334e007
Merge pull request #32 from jonathan-taylor/master
jonathan-taylor Oct 10, 2017
43fbddf
added a full n>p example
jonathan-taylor Oct 10, 2017
151c21d
Merge branch 'master' of github.com:selective-inference/R-software
jonathan-taylor Oct 11, 2017
a6fcd6e
fix of signs for full
jonathan-taylor Oct 11, 2017
c5bf9f6
Merge pull request #33 from jonathan-taylor/master
tibshirani Oct 11, 2017
8ad2f63
variable rename
jonathan-taylor Oct 11, 2017
749c136
rob added unifTest.R
tibshirani Oct 11, 2017
9c7ee2b
rob modified unifTest.R
tibshirani Oct 11, 2017
85f7063
rob modified unifTest.R
tibshirani Oct 11, 2017
5f971f6
rob added unifTest.R
tibshirani Oct 11, 2017
42fc515
rob modified unifTest.R
tibshirani Oct 11, 2017
781609d
rob modified unifTest.R
tibshirani Oct 11, 2017
3da6c50
NF: density functions for randomized LASSO
jonathan-taylor Oct 25, 2017
e0eb1c6
T to TRUE
jonathan-taylor Oct 25, 2017
b23b189
updated wide C code -- can now do ridge as well as variable weights -…
jonathan-taylor Oct 26, 2017
ffccea5
removing machine generated files
jonathan-taylor Oct 26, 2017
2c0e3d6
WIP: function to fit randomized lasso
jonathan-taylor Oct 26, 2017
2439d73
check that solution is same as old code -- currently failing
jonathan-taylor Oct 27, 2017
83b0426
bug found in qp solver -- look at tests/test_QP.R
jonathan-taylor Oct 27, 2017
f13bce4
allowing randomization to be 0 in solver
jonathan-taylor Oct 27, 2017
a6064f2
cosmetic edit
jonathan-taylor Oct 27, 2017
2d685c0
LASSO solver is right up to scale
jonathan-taylor Oct 27, 2017
cc88b97
Confidence intervals when estimate is negative
nicoballarini Oct 27, 2017
7b23150
Confidence intervals when estimate is negative
nicoballarini Oct 27, 2017
928fee9
variable rename
jonathan-taylor Oct 11, 2017
2e9b11d
NF: density functions for randomized LASSO
jonathan-taylor Oct 25, 2017
c3b55f5
T to TRUE
jonathan-taylor Oct 25, 2017
3748723
updated wide C code -- can now do ridge as well as variable weights -…
jonathan-taylor Oct 26, 2017
5a07245
removing machine generated files
jonathan-taylor Oct 26, 2017
ede2816
WIP: function to fit randomized lasso
jonathan-taylor Oct 26, 2017
32feb0e
check that solution is same as old code -- currently failing
jonathan-taylor Oct 27, 2017
0a99f5f
bug found in qp solver -- look at tests/test_QP.R
jonathan-taylor Oct 27, 2017
242218e
allowing randomization to be 0 in solver
jonathan-taylor Oct 27, 2017
360dcbd
cosmetic edit
jonathan-taylor Oct 27, 2017
f5a3b96
LASSO solver is right up to scale
jonathan-taylor Oct 27, 2017
506a205
BF: fixing Xsoln incorrectly set in wide solver
jonathan-taylor Oct 27, 2017
0be39c4
gradient not current?
jonathan-taylor Oct 27, 2017
3ee2a43
print R2 from lm
jonathan-taylor Oct 27, 2017
92812fc
without linesearch we know agree with Adel's code at fixed mu
jonathan-taylor Oct 27, 2017
abf0824
fixing documentation
jonathan-taylor Oct 27, 2017
1658ecb
checking comparison example again -- looks good
jonathan-taylor Oct 27, 2017
e3049cf
removing the offset_correction which was just for the comparison
jonathan-taylor Oct 27, 2017
32d4bd5
Merge pull request #35 from nicoballarini/patch-1
jonathan-taylor Oct 27, 2017
4e42c75
Merge pull request #34 from nicoballarini/patch-2
jonathan-taylor Oct 27, 2017
fc49dcd
created the matrices for the affine transform, wrapper for calling Ga…
jonathan-taylor Oct 28, 2017
d1dc82d
unwanted files
jonathan-taylor Oct 28, 2017
8ca2028
wrapper for conditional density
jonathan-taylor Oct 28, 2017
07d7c6c
forming internal affine transform
jonathan-taylor Oct 28, 2017
9d1c79b
vectorized densities evaluate OK -- need to check results
jonathan-taylor Oct 28, 2017
5393dcd
added laplace densities
jonathan-taylor Oct 28, 2017
b637448
using C-software submodule for selectiveInference/src
jonathan-taylor Oct 31, 2017
39b9675
updating travis script
jonathan-taylor Oct 31, 2017
cd918b1
variable rename
jonathan-taylor Oct 11, 2017
ac2bbc8
NF: density functions for randomized LASSO
jonathan-taylor Oct 25, 2017
75c71dc
T to TRUE
jonathan-taylor Oct 25, 2017
49d0b67
updated wide C code -- can now do ridge as well as variable weights -…
jonathan-taylor Oct 26, 2017
0dbc310
removing machine generated files
jonathan-taylor Oct 26, 2017
7480310
WIP: function to fit randomized lasso
jonathan-taylor Oct 26, 2017
38b2020
check that solution is same as old code -- currently failing
jonathan-taylor Oct 27, 2017
dc423de
bug found in qp solver -- look at tests/test_QP.R
jonathan-taylor Oct 27, 2017
71ff6e3
allowing randomization to be 0 in solver
jonathan-taylor Oct 27, 2017
de8874b
cosmetic edit
jonathan-taylor Oct 27, 2017
07f738c
LASSO solver is right up to scale
jonathan-taylor Oct 27, 2017
2f1686e
BF: fixing Xsoln incorrectly set in wide solver
jonathan-taylor Oct 27, 2017
6444472
gradient not current?
jonathan-taylor Oct 27, 2017
9f26844
print R2 from lm
jonathan-taylor Oct 27, 2017
9c7bfcc
without linesearch we know agree with Adel's code at fixed mu
jonathan-taylor Oct 27, 2017
c2460a1
fixing documentation
jonathan-taylor Oct 27, 2017
ce15b68
checking comparison example again -- looks good
jonathan-taylor Oct 27, 2017
e01d8f1
removing the offset_correction which was just for the comparison
jonathan-taylor Oct 27, 2017
eedf0fd
created the matrices for the affine transform, wrapper for calling Ga…
jonathan-taylor Oct 28, 2017
e8a94ef
unwanted files
jonathan-taylor Oct 28, 2017
b2de9d9
wrapper for conditional density
jonathan-taylor Oct 28, 2017
6dfdd0d
forming internal affine transform
jonathan-taylor Oct 28, 2017
c175a8b
vectorized densities evaluate OK -- need to check results
jonathan-taylor Oct 28, 2017
c940537
added laplace densities
jonathan-taylor Oct 28, 2017
206e236
BF: variable rename
jonathan-taylor Oct 31, 2017
2917d6e
BF: forgot to cd up directory
jonathan-taylor Oct 31, 2017
63e60df
changing order of stop arguments
jonathan-taylor Oct 31, 2017
57d91d4
changing order of stops
jonathan-taylor Oct 31, 2017
ff598d0
Merge pull request #36 from jonathan-taylor/master
tibshirani Oct 31, 2017
46713f0
Merge branch 'master' into cython
jonathan-taylor Oct 31, 2017
232760d
Merge pull request #37 from jonathan-taylor/master
jonathan-taylor Oct 31, 2017
50601d2
merging with upstream
jonathan-taylor Nov 1, 2017
f774483
unused import
jonathan-taylor Nov 1, 2017
da1b9b5
column major ordering in C library
jonathan-taylor Nov 1, 2017
8bd3c12
tests are in different directory
jonathan-taylor Nov 1, 2017
89c115e
Merge pull request #38 from jonathan-taylor/master
jonathan-taylor Nov 1, 2017
ae9aec8
WIP: have sample from optimization density, importance weight -- need…
jonathan-taylor Nov 2, 2017
177ab78
update to C-software, using a compiler define for column major
jonathan-taylor Nov 3, 2017
1d60dfa
update to C-software, using a compiler define for column major
jonathan-taylor Nov 3, 2017
3ce4ea2
pivots running but weights all zero
Nov 5, 2017
555f38c
reorg
Nov 5, 2017
fdff629
segfault error
Nov 6, 2017
68e27f4
bug in weights
Nov 6, 2017
0fa7c4e
condl bug fixed
Nov 6, 2017
8f99570
added ci
Nov 6, 2017
9597497
removed local import
jonathan-taylor Nov 6, 2017
a8d50a6
Merge branch 'jelena-markovic-randomized_jelena'
jonathan-taylor Nov 6, 2017
71b6586
BF: segfault seems fixed -- ensured all functions have some order of …
jonathan-taylor Nov 7, 2017
e0ee2a7
jelena's inference functions
jonathan-taylor Nov 7, 2017
09db28a
BF: seems ncase and nfeature were swapped in some places in C code
jonathan-taylor Nov 7, 2017
95b98c2
minor cleanup -- doesn't seem to use conditional_density?
jonathan-taylor Nov 7, 2017
a1ad181
Merge pull request #1 from jonathan-taylor/master
Nov 7, 2017
07b6bb7
coverages
Nov 7, 2017
1115635
subgrad condition option added
Nov 7, 2017
e2f4585
bug
Nov 7, 2017
df777e3
using some default arguments now -- bug in C code for densities
jonathan-taylor Nov 7, 2017
ff34a52
dealing with zero length active set
Nov 7, 2017
1c538ed
Merge branch 'jelena-markovic-randomized_jelena'
jonathan-taylor Nov 7, 2017
ab91969
now nut running after trying to set default arguments
jonathan-taylor Nov 7, 2017
5b4bc08
BF: estimate of sigma
jonathan-taylor Nov 7, 2017
46856e1
changing arguments
jonathan-taylor Nov 7, 2017
d1ebca3
BF: noise_scale was NULL
jonathan-taylor Nov 7, 2017
0f1833f
seems to be running now with default arguments
jonathan-taylor Nov 7, 2017
8187b53
forgot one bit of C code to use
jonathan-taylor Nov 7, 2017
6dae27c
weights running in |E|+1 dimensions
Nov 7, 2017
e90a8f1
BF: opt_transform linear_term was not cast as matrix in conditional_d…
jonathan-taylor Nov 7, 2017
2b49b94
working instance
Nov 8, 2017
571cf82
export of randomized and man page
jonathan-taylor Nov 8, 2017
9adbe9b
adding resid to namespace
jonathan-taylor Nov 8, 2017
eda1482
fixing to make check pass
jonathan-taylor Nov 8, 2017
3ca4431
param_stop
jonathan-taylor Nov 8, 2017
d838b07
merged with smaller dimensional matrices
jonathan-taylor Nov 8, 2017
7f8b8fd
For gaussian randomization, remove all p-dimensional matrices
jonathan-taylor Nov 8, 2017
690f0ea
fixing function signature
jonathan-taylor Nov 8, 2017
9e7a081
Merge pull request #39 from jonathan-taylor/master
tibshirani Nov 8, 2017
6c1a123
added mean and cov of a gaussian
Nov 8, 2017
d2a3b9b
transpose
Nov 8, 2017
e2efbdc
working! bugs fixed. new sampler
Nov 9, 2017
e739255
active set zero
Nov 9, 2017
b4fd8b5
removed set seed when gen randomization
Nov 9, 2017
d2438c9
amir sampler working with subgrad condition false as well
Nov 9, 2017
ce13171
logistic
Nov 9, 2017
157c1db
E of zero length
Nov 10, 2017
1dfbea8
fixing man page so check passes
jonathan-taylor Nov 10, 2017
fa08285
Merge branch 'jelena-markovic-randomized_jelena'
jonathan-taylor Nov 10, 2017
b21260a
renaming file
jonathan-taylor Nov 10, 2017
183bc3a
stop instead of print
jonathan-taylor Nov 10, 2017
4fc539d
Merge branch 'master' into logistic
jonathan-taylor Nov 10, 2017
42cd878
WIP: adding logistic option, need to solve logistic problem
jonathan-taylor Nov 10, 2017
69bf473
Merge branch 'jelena-markovic-logistic'
jonathan-taylor Nov 10, 2017
af3b818
fixing empty inactive set indexing problem
jonathan-taylor Nov 10, 2017
a2e32dc
Merge pull request #41 from jonathan-taylor/master
tibshirani Nov 10, 2017
9de1b7c
rob chanegd NAMESPACE
tibshirani Nov 15, 2017
a6c495b
Fixed handling of numeric variables in factorDesign
coreybrier Apr 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**DS_Store**
**Rcheck**
**tar.gz
**Rapp.history
**.pdf
**.RData
**.o
**.so
forLater/josh/**
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "C-software"]
path = C-software
url = https://github.com/selective-inference/C-software.git
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: r
cache: packages
sudo: false
r:
- oldrel
- release
- devel
addons:
apt:
packages: libmpfr-dev
warnings_are_errors: true
before_install:
- tlmgr install index # for texlive and vignette?
- R -e 'install.packages(c("Rcpp", "intervals", "adaptMCMC", "glmnet"), repos="http://cloud.r-project.org")'
- cd C-software
- git submodule init
- git submodule update
- cd ..
- make src
- make Rcpp
- cd selectiveInference
1 change: 1 addition & 0 deletions C-software
Submodule C-software added at 563bf1
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Rcpp:
- rm -f selectiveInference/src/RcppExports.cpp
- rm -f selectiveInference/R/RcppExports.R
Rscript -e "library(Rcpp); Rcpp::compileAttributes('selectiveInference')"

install: Rcpp src
R CMD INSTALL selectiveInference

build: src
R CMD build selectiveInference

src:
cp C-software/src/* selectiveInference/src

check: Rcpp build
R CMD build selectiveInference
R CMD check selectiveInference_1.2.2.tar.gz # fix this to be a script variable
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# R-software
R software for [selective inference](http://cran.r-project.org/web/packages/selectiveInference/).
Authors: Ryan Tibshirani, Rob Tibshirani, Jonathan Taylor, Joshua Loftus, Stephen Reid
Maintainer: Rob Tibshirani <[email protected]>

New tools for inference after selection, for use with forward stepwise regression, least angle regression, the lasso, and the many means problem. The package is available on [CRAN](http://cran.r-project.org/web/packages/selectiveInference/). See [this paper](http://www.pnas.org/content/112/25/7629.full) for a high level introduction to selective inference.

Code is in the directory selectiveInference/R.
* funs.common.R: Basic functions used by many other functions, such as standardization.
* funs.fixed.R: Inference for LASSO at a fixed, deterministic value of lambda.
* funs.fs.R: Inference for forward stepwise.
* funs.groupfs.R: Inference for forward stepwise with groups of variables, e.g. factors.
* funs.inf.R: Common functions for inference with fixed, fs, lar, and manymeans (but not group).
* funs.lar.R: Inference for least angle regression.
* funs.max.R: Some numerical approximations. Deprecated?

## Installation
The latest release of the package can be installed through CRAN:

```R
install.packages("selectiveInference")
```
Code in repo is under development and may be unstable.

## For development

You will have to run

```
make Rcpp
```
70 changes: 70 additions & 0 deletions forLater/estimateLambda.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
\name{estimateLambda}
\alias{estimateLambda}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Estimates the lasso tuning parameter lambda.
}
\description{
Estimates the lasso tuning parameter lambda, for use in the selectiveInference
package
}
\usage{
estimateLambda(x, sigma, nsamp=1000)
}
\arguments{
\item{x}{
Matrix of predictors (n by p)
}
\item{sigma}{
Estimate of error standard deviation
}
\item{nsamp}{Number of Monte carlo samples used for the estimation.}
}
\details{
This function estimates the lasso tuning parameter lambda, using the estimate
2*E(||X^T eps||_infty) where eps ~ N(0,sigma^2), a vector of length n.
This estimate was proposed by Negahban et al (2012).
}
\value{
\item{sigmahat}{The estimate of sigma}
\item{df}{The degrees of freedom of lasso fit used}
}
\references{
Negahban, S. N.,
Ravikumar, P.,
Wainwright, M. J.
and Yu, B.
(2012). A unified
framework for high-dimensional analysis of
M-estimators with decomposable regularizers.
Statistical Science vol. 27, p 538-557.
}

\author{Ryan Tibshirani, Rob Tibshirani, Jonathan Taylor, Joshua Loftus, Stephen Reid}

\examples{
#NOT RUN
#set.seed(43)
#n=50
#p=10
#sigma=.7
#x=matrix(rnorm(n*p),n,p)
#x=scale(x,T,F)
#beta=c(3,2,0,0,rep(0,p-4))
#y=x%*%beta+sigma*rnorm(n)
#y=y-mean(y)
#
#estimate lambda usingthe known value of sigma
#lamhat=estimateLambda(x,sigma=.7)
#
#first estimate sigma
#sigmahat=estimateSigma(x,y)$sigmahat
#lamhat=estimateLambda(x,sigma=sigmahat)

#compare to estimate from cv

#out=cv.glmnet(x,y)
#out$lambda.min*n #remember that value from glmnet must be
# multiplied by n, to make it comparable.
}

81 changes: 81 additions & 0 deletions forLater/fixedLassoPoly.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
\name{fixedLassoPoly}
\alias{fixedLassoPoly}

\title{
Compute polyhedral constraints for a LASSO problem with
a fixed value of lambda.
}
\description{
Compute polyhedral representation of the selection region of Lee et al. (2016).
By construction, y should satisfy A %*% y elementwise less then or equal b.
}
\usage{
fixedLassoPoly(X, y, lambda, beta, active, inactive = FALSE)
}
\arguments{
\item{X}{
Design matrix of LASSO problem.
}
\item{y}{
Response of LASSO problem.
}
\item{lambda}{
Value of regularization parameter.
}
\item{beta}{
Solution of LASSO problem with regularization parameter set to lambda.
}
\item{active}{
Active set of the LASSO problem as a boolean vector. Should correspond
to the non-zeros of beta.
}
\item{inactive}{
Form the inactive constraints as well?
}
}
\details{
This function computes
the polyhedral representation of the selection region of Lee et al. (2016).
}

\value{
\item{A}{Linear part of the affine inequalities.}
\item{b}{RHS offset the affine inequalities.}
}

\references{
Jason Lee, Dennis Sun, Yuekai Sun, and Jonathan Taylor (2016).
Exact post-selection inference, with application to the lasso. Annals of Statistics, 44(3), 907-927.

Jonathan Taylor and Robert Tibshirani (2017) Post-selection inference for math L1-penalized likelihood models.
Canadian Journal of Statistics, xx, 1-21. (Volume still not posted)
}
\author{Ryan Tibshirani, Rob Tibshirani, Jonathan Taylor, Joshua Loftus, Stephen Reid}

\examples{

set.seed(43)
n = 50
p = 10
sigma = 1

x = matrix(rnorm(n*p),n,p)
x = scale(x,TRUE,TRUE)

beta = c(3,2,rep(0,p-2))
y = x\%*\%beta + sigma*rnorm(n)

# first run glmnet
gfit = glmnet(x,y,standardize=FALSE)

# extract coef for a given lambda; note the 1/n factor!
# (and we don't save the intercept term)
lambda = .8
beta = coef(gfit, s=lambda/n, exact=TRUE)[-1]
active = (beta != 0)

fixedLassoPoly(x, y, lambda, beta, active)
fixedLassoPoly(x, y, lambda, beta, active, inactive=TRUE)

}

Loading