refit.mhtp: Multiple testing procedure for variable selection in linear...

Description Usage Arguments Details Value See Also Examples

View source: R/refit.mhtp.R

Description

Performs a multiple hypotheses testing in linear mixed models

Usage

1
2
## S3 method for class 'mhtp'
refit(object,Ynew,z,grp,D,fix,rand,alpha,step,num,ordre,m,show,IT,maxq,speed,...)

Arguments

object

Object of class "mhtp".

Ynew

Response variable of length n.

z

Random effects matrix. Of size n*q.

grp

Grouping variable of length n.

D

Logical value. If TRUE, the random effects are considered to be independent, i.e. Psi is a diagonal matrix. D=TRUE should be used with nested grouping factors.

fix

Number of variables which are not submitted to selection. They have to be in the first columns of data. Default is 1, the selection is not performed on the intercept.

rand

A vector of length q: each entry k is the position of the random effects number k in the data matrix, 0 otherwise. If z contains variables that have both a fixed and a random effect, it is advised to not submit them to selection.

alpha

A user supplied type I error sequence. Default is (0.1,0.05).

step

The algorithm performs at most step iterations. Default is 3000.

num

Number of variables one wishes to order. Default is min(n-1,p-1,30).

ordre

Several possible algorithms to order the variables, ordre=c("bolasso","pval","pval_hd","FR"). "bolasso" uses the dyadic algorithm with the Bolasso techniaue, "pval" uses the p-values obtained with a regression on the full set of variables (only when p<n), "pval_hd" uses marginal regression, "FR" uses Forward Regression. Default is "bolasso".

m

Number of bootstrapped iteration of the Lasso. Only use if the algorithm is set to "bolasso". Default is m=10.

show

Vector of logical values, show=(showordre,showresult,showit). Default is (0,0,0). If showordre==TRUE, show the ordered variables at each step of the algorithm. if showresult==TRUE, show the value of the statistics and the estimated quantile at each step of the procedure; if ordre=bolasso. if showit==TRUE, show the iterations of the algorithm.

IT

Number of simulations in the calculation of the quantile. Default is 10000.

maxq

Number of maximum multiple hypotheses testing to do. Default is min(log(min(n,p)-1,2),5).

speed

Logical value. If TRUE, the algorithm is speeded up once the criterion convergence in beta and u is fulfilled.

...

not used

Details

See mhtp for more details.

Value

A 'mhtp object' is returned.

data

List of the user-data: the scaled matrix used in the algorithm, the first column being (1,...,1); Y; z and grp.

beta

Estimation of the selected fixed effects.

fitted.values

Fitted values calculated with the fixed effects and the random effects.

u

Matrix with #alpha columns. Each column is the concatenation of the estimated random effects (u_1',...,u_q')' for the user level alpha.

Psi

Variance of the random effects. Matrix of dimension q*q.

sigma_e

Variance of the noise.

it

Number of iterations of the algorithm.

quantile

Array of all the estimated quantiles calculated during the procedure.

ordrebeta

All different order that has been used during the procedure.

converge

Did the algorithm converge?

call

The call that produced this object.

arg

List of all the arguments of the function.

See Also

mhtp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
N <- 20           # number of groups
p <- 20            # number of covariates (including intercept)
q <- 2            # number of random effect covariates
ni <- rep(6,N)    # observations per group
n <- sum(ni)   # total number of observations

grp <- factor(rep(1:N,ni)) # grouping variable
grp=rbind(grp,grp)

beta <- c(1,2,4,3,rep(0,p-3)) # fixed-effects coefficients
x <- cbind(1,matrix(rnorm(n*p),nrow=n)) # design matrix

u1=rnorm(N,0,sd=sqrt(2))
u2=rnorm(N,0,sd=sqrt(2))
bi1 <- rep(u1,ni) 
bi2 <- rep(u2,ni)
bi <- rbind(bi1,bi2)

z=x[,1:2,drop=FALSE]
   
epsilon=rnorm(120)
y <- numeric(n)
for (k in 1:n) y[k] <- x[k,]%*%beta + t(z[k,])%*%bi[,k] + epsilon[k]

########
fit=mhtp(x,y,z,grp,D=0,fix=1,rand=c(1,2),alpha=0.1,num=15)
fit2=refit(fit,Ynew=y)

## End(Not run)

MMS documentation built on May 2, 2019, 12:38 p.m.