xu1912 / EPSLASSO

An R package for regression analysis of data from extreme sampling
GNU Lesser General Public License v3.0
0 stars 0 forks source link

tutorial #1

Open SC-Duan opened 6 years ago

SC-Duan commented 6 years ago

Hi, Can you give a tutorial?

xu1912 commented 6 years ago

Hi, thanks for asking.

I list an example below which is in the help document. You may find it after installation.

The main function of this package is epsLasso(X, Y, c1, c2), where X is the matrix of predictors with each row represents an individual; Y is the phenotypic value; c1 is the right censored phenotypic value; c2 is the left censored phenotypic value.

The example below generated a fake date set of X, Y, c1, and c2. Then epsLasso was applied.

I will add a tutorial mostly like this in Github later. Thanks again!

' library(mvtnorm)

' sd=1

' n=100

' p1=0.2

' p2=0.2

' p=100

' nc=10

' eff=0.5

'

' beta_eff=c(rep(eff,nc),rep(0,p-nc))

'

' cov_m=diag(p)

' X_b=rmvnorm(n,mean=c(rep(1,p/2),rep(2,p/2)), sigma=cov_m)

' Y_b=X_b%%beta_eff+rnorm(n,0,sd) #' sample_threshold_low=ceiling(np1)

' sample_threshold_up=ceiling(n*p2)

'

' ind_sample = order(Y_b)[c(1:sample_threshold_low,(n-sample_threshold_up+1):n)]

' Y_p = Y_b[ind_sample]

' c1 = min(Y_b[ind_sample[-(1:sample_threshold_low)]])

' c2 = max(Y_b[ind_sample[1:sample_threshold_low]])

' X_p = X_b[ind_sample,]

'

' res=epsLasso(X_p,Y_p,c1,c2)

' res