Description Usage Arguments Details Value Examples
This function can run Friedman's MARS models on the untransformed design matrix. To be used with simulated data where the 'truth' is known i.e., you know which features are associated with the response. This function was used to produce the simulation results in Bhatnagar et al. 2016. Uses caret functions to tune the degree and the nprune parameters
1 2 3 |
x_train |
|
x_test |
|
y_train |
numeric vector of length |
y_test |
numeric vector of length |
s0 |
chracter vector of the active feature names, i.e., the features in
|
model |
Type of non-linear model to be fit. Currently only Friedman's MARS is supported. |
exp_family |
Response type. See details for |
topgenes |
List of features to keep if |
stability |
Should stability measures be calculated. Default is
|
filter |
Should analysis be run on a subset of features. Default is
|
include_E |
Should the environment variable be included in the
regression analysis. Default is |
include_interaction |
Should interaction effects between the features in
|
... |
other parameters passed to |
This function first does 10 fold cross-validation to tune the degree
(either 1 or 2) using the train
function with
method="earth"
and nprune is fixed at 1000. Then the
earth
function is used, with nk = 1000
and
pmethod = "backward"
to fit the MARS model using the optimal degree
from the 10-fold CV.
This function has two different outputs depending on whether
stability = TRUE
or stability = FALSE
If stability = TRUE
then this function returns a p x 2
data.frame or data.table of regression coefficients without the intercept.
The output of this is used for subsequent calculations of stability.
If stability = FALSE
then returns a vector with the following
elements (See Table 3: Measures of Performance in Bhatnagar et al (2016+)
for definitions of each measure of performance):
mse or AUC |
Test set
mean squared error if |
RMSE |
Square root of the mse. Only
applicable if |
Shat |
Number of non-zero estimated regression coefficients. The non-zero estimated regression coefficients are referred to as being selected by the model |
TPR |
true positive rate |
FPR |
false positive rate |
Correct Sparsity |
Correct true positives + correct true negative coefficients divided by the total number of features |
CorrectZeroMain |
Proportion of correct true negative main effects |
CorrectZeroInter |
Proportion of correct true negative interactions |
IncorrectZeroMain |
Proportion of incorrect true negative main effects |
IncorrectZeroInter |
Proportion of incorrect true negative interaction effects |
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ## Not run:
library(magrittr)
# simulation parameters
rho = 0.90; p = 500 ;SNR = 1 ; n = 200; n0 = n1 = 100 ; nActive = p*0.10 ; cluster_distance = "tom";
Ecluster_distance = "difftom"; rhoOther = 0.6; betaMean = 2;
alphaMean = 1; betaE = 3; distanceMethod = "euclidean"; clustMethod = "hclust";
cutMethod = "dynamic"; agglomerationMethod = "average"
#in this simulation its blocks 3 and 4 that are important
#leaveOut: optional specification of modules that should be left out
#of the simulation, that is their genes will be simulated as unrelated
#("grey"). This can be useful when simulating several sets, in some which a module
#is present while in others it is absent.
d0 <- s_modules(n = n0, p = p, rho = 0, exposed = FALSE,
modProportions = c(0.15,0.15,0.15,0.15,0.15,0.25),
minCor = 0.01,
maxCor = 1,
corPower = 1,
propNegativeCor = 0.3,
backgroundNoise = 0.5,
signed = FALSE,
leaveOut = 1:4)
d1 <- s_modules(n = n1, p = p, rho = rho, exposed = TRUE,
modProportions = c(0.15,0.15,0.15,0.15,0.15,0.25),
minCor = 0.4,
maxCor = 1,
corPower = 0.3,
propNegativeCor = 0.3,
backgroundNoise = 0.5,
signed = FALSE)
truemodule1 <- d1$setLabels
X <- rbind(d0$datExpr, d1$datExpr) %>%
magrittr::set_colnames(paste0("Gene", 1:p)) %>%
magrittr::set_rownames(paste0("Subject",1:n))
betaMainEffect <- vector("double", length = p)
# the first nActive/2 in the 3rd block are active
betaMainEffect[which(truemodule1 %in% 3)[1:(nActive/2)]] <- runif(
nActive/2, betaMean - 0.1, betaMean + 0.1)
# the first nActive/2 in the 4th block are active
betaMainEffect[which(truemodule1 %in% 4)[1:(nActive/2)]] <- runif(
nActive/2, betaMean+2 - 0.1, betaMean+2 + 0.1)
beta <- c(betaMainEffect, betaE)
result <- s_generate_data_mars(p = p, X = X,
beta = beta,
binary_outcome = FALSE,
truemodule = truemodule1,
nActive = nActive,
include_interaction = FALSE,
cluster_distance = cluster_distance,
n = n, n0 = n0,
eclust_distance = Ecluster_distance,
signal_to_noise_ratio = SNR,
distance_method = distanceMethod,
cluster_method = clustMethod,
cut_method = cutMethod,
agglomeration_method = agglomerationMethod,
nPC = 1)
mars_res <- s_mars_separate(x_train = result[["X_train"]],
x_test = result[["X_test"]],
y_train = result[["Y_train"]],
y_test = result[["Y_test"]],
s0 = result[["S0"]],
exp_family = "gaussian")
unlist(mars_res)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.