# Simple examples with random data here
# Real data examples in the Vignette
# Random data: covariates A,B,C are correlated with Y
set.seed(1)
Y <- rnorm(20)
X <- matrix(rnorm(200), 20, 10)
X[,1:3] <- X[,1:3] + Y
colnames(X) <- LETTERS[1:10]
# Compare the global test with the F-test
gt(Y, X)
anova(lm(Y~X))
# Using formula input
res <- gt(Y, ~A+B, null=~C+E, data=data.frame(X))
summary(res)
# Beware: null models with and without intercept
Z <- rnorm(20)
summary(gt(Y, X, null=~Z))
summary(gt(Y, X, null=Z))
# Logistic regression
gt(Y>0, X)
# Subsets and weights (1)
my.sets <- list(c("A", "B"), c("C","D"), c("D", "E"))
gt(Y, X, subsets = my.sets)
my.weights <- list(1:2, 2:1, 3:2)
gt(Y, X, subsets = my.sets, weights=my.weights)
# Subsets and weights (2)
gt(Y, X, subset = c("A", "B"))
gt(Y, X, subset = c("A", "A", "B"))
gt(Y, X, subset = c("A", "A", "B"), weight = c(.5,.5,1))
# Permutation testing
summary(gt(Y, X, perm=1e4))
Run the code above in your browser using DataLab