# NOT RUN {
<!-- %% parts of the following code are in donttest environment to -->
# }
# NOT RUN {
<!-- %% speed-up computing -->
# }
# NOT RUN {
<!-- %% >>> copy any changes to "../tests/ex-lasso.proj.R" <<< to ensure -->
# }
# NOT RUN {
<!-- %% code is running -->
# }
# NOT RUN {
x <- matrix(rnorm(100*20), nrow = 100, ncol = 10)
y <- x[,1] + x[,2] + rnorm(100)
fit.lasso <- lasso.proj(x, y)
which(fit.lasso$pval.corr < 0.05) # typically: '1' and '2' and no other
## Group-wise testing of the first two coefficients
fit.lasso$groupTest(1:2)
##Compute confidence intervals
confint(fit.lasso, level = 0.95)
# }
# NOT RUN {
## Hierarchical testing using distance matrix based on
## correlation matrix
out.clust <- fit.lasso$clusterGroupTest()
plot(out.clust)
## Fit the lasso projection method without doing the preparations
## for group testing (saves time and memory)
fit.lasso.faster <- lasso.proj(x, y, suppress.grouptesting = TRUE)
## Use the scaled lasso for the initial estimate
fit.lasso.scaled <- lasso.proj(x, y, betainit = "scaled lasso")
which(fit.lasso.scaled$pval.corr < 0.05)
## Use a robust estimate for the standard error
fit.lasso.robust <- lasso.proj(x, y, robust = TRUE)
which(fit.lasso.robust$pval.corr < 0.05)
# }
# NOT RUN {
## Perform the Z&Z version of the lasso projection method
fit.lasso <- lasso.proj(x, y, do.ZnZ = TRUE)
which(fit.lasso$pval.corr < 0.05) # typically: '1' and '2' and no other
# }
Run the code above in your browser using DataLab