affinelassotest: Affine lasso test

Description Usage Arguments Value Author(s) References Examples

View source: R/affinelassotest.R

Description

Perform thresholding tests for null hypothesis of the form H0: A beta = c.

Usage

1
2
3
affinelassotest(y, Xdata, family = gaussian, alpha, beta0=NA, cc = NA, lambdas = NA, 
outrescale = NA, intercept = TRUE, group.sizes = rep(1, ncol(X)), A = ncol(X), 
LAD = FALSE, composite = TRUE, M = round(min(10000, max(1000, 1e+09/nrow(X)/ncol(X)))))

Arguments

y

response variable. Quantitative for family=gaussian, or family=poisson (non-negative counts). For family=binomial should be a factor with two levels.

Xdata

input matrix, of dimension n x p; each row is an observation vector.

family

response type (see above). Default is gaussian.

alpha

desired level of the test.

beta0

if known, value of the nuissance parameter. Otherwise it takes beta0=0, and the statistic is asymptotically a pivot for non-Gaussian.

cc

vector c

lambdas

if not provided, the code performs M Monte Carlo simulation to obtain the empirical distribution Λ and the corresponding value in the α-quantile for testing. Otherwise, vector with all the Monte Carlo values of lambda. Default is NA.

outrescale

object containing all variables corresponding to the rescaling and test options. If not provided, this is calculated authomatically with function processX. Default is NA.

intercept

should intercept(s) be fitted (default=TRUE) or set to zero (FALSE).

group.sizes

the vector of group sizes for affine group lasso. The number of elements is L and sum(group.sizes) should be equal to P. If L==P, then the lasso test is employed, otherwise group lasso. Default is no groups, so rep(1,ncol(X)).

A

if A is a matrix it tests A beta = c. If A is a vector, then it gives the indexes of the parameters to be tested. Used if family=gaussian. Default is to test beta=0, so A=ncol(X).

LAD

set TRUE if LAD lasso test. Default is FALSE

composite

set TRUE if composite test (O & +). Default is TRUE

M

number of Monte Carlo Simulations to estimate the distribution Λ.

Value

lambda.alpha

value of λ in the α-quantile

lambda.data

value of λ for the current data.

rejectH0

result of the test. TRUE if H0 is rejected.

lambdas

values of λ of the Monte Carlo simulation under the null hypothesis.

outrescale

object containing all the rescaling variables.

pvalue

approximate p-value for current data.

Author(s)

Sylvain Sardy and Jairo Diaz Rodriguez

References

Thresholding tests. Sylvain Sardy, Caroline Giacobino, Jairo Diaz.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
	# Test H0:beta=0
		P=200
		N=20
		s=1
		A=P
		alpha=0.05
		X=matrix(rnorm(N*P),N,P)
		M=100 #Leave the default or select higher value for better level.
	
	#when H0 is not rejected
		beta_scal=0
		beta=c(rep(beta_scal, s), rep(0, P-s)) 
		y=X%*%beta+rnorm(N)
		out=affinelassotest(y,X,gaussian,alpha,M=M)
		print(out$rejectH0)
	
	#when H0 is rejected
		beta_scal=10
		beta=c(rep(beta_scal, s), rep(0, P-s)) 
		y=X%*%beta+rnorm(N)
		out=affinelassotest(y,X,gaussian,alpha,M=M)
		print(out$rejectH0)

qut documentation built on Jan. 19, 2021, 5:09 p.m.