Learn R Programming

qut (version 2.2)

ztf: Zero thresholding function

Description

Obtains the value of the minimum regularization parameter that sets all coefficients to zero for different types of thresholding tests.

Usage

ztf(y,Xdata, family=gaussian, A=ncol(Xdata), cc=NA, intercept=TRUE,
group.sizes=rep(1,ncol(Xdata)), LAD=FALSE, outrescale=NA, composite=TRUE, alpha=0,
M=min(1.e4, max(1000,1.e10/nrow(Xdata)/ncol(Xdata))))

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.

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).

cc

vector c

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)).

LAD

set TRUE if LAD lasso test. Default is FALSE

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.

composite

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

alpha

alpha for quantile rescaling; if alpha=0, then no rescaling.

M

number of Monte Carlo Simulations to estimate the distribution \(\Lambda\).

Value

value of the minimum regularization parameter that sets all coefficients to zero

Examples

Run this code
# NOT RUN {
	# Test H0:beta=0
		P=200
		N=20
		s=1
		A=P
		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)
		zerolambda=ztf(y,X,M=M)
		print(zerolambda)
	
	#when H0 is rejected
		beta_scal=10
		beta=c(rep(beta_scal, s), rep(0, P-s)) 
		y=X%*%beta+rnorm(N)
		zerolambda=ztf(y,X,M=M)
		print(zerolambda)
# }

Run the code above in your browser using DataLab