Description Usage Arguments Value Examples
View source: R/PredictionModel.R
A Function to build a logistic regression prediction model on the training dataset, and make predictions on the test dataset.
1 | LR.model(train.data, test.data)
|
train.data |
[data.frame] The training dataset. It must contain a column named Y providing the case/control phenotype (0 = unaffected (control), 1 = affected (case)). |
test.data |
[data.frame] The test dataset. It must contain a column named Y providing the case/control phenotype (0 = unaffected (control), 1 = affected (case)). |
LR.model
return a vector containing the predicted probability.
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 | input.dir <- system.file("extdata", package="PrismVote")
output.dir <- system.file("extdata", package="PrismVote")
path2plink <- '/path/to/plink'
## Not run:
covar.number <- c(2, 3)
feature.selection.result <- feature.selection(input.dir = input.dir,
output.dir = output.dir,
genotype = "train",
phenotype = "train.phenotypes.txt",
covar.number = covar.number,
plink.path = path2plink,
topK = 10,
verbose = TRUE)
train.genotype.path <- file.path(input.dir, "train.raw")
train.genotype.path <- gsub('\\\\', '/', train.genotype.path)
train.phenotype.path <- file.path(input.dir, "train.phenotypes.txt")
train.phenotype.path <- gsub('\\\\', '/', train.phenotype.path)
train.data <- data.table::fread(train.genotype.path, data.table = FALSE)[, -c(1,2,3,4,5,6)]
colnames(train.data) <- unlist(purrr::map(colnames(train.data),function(x) {substr(x,1, nchar(x)-2)}))
train.pheno <- data.table::fread(train.phenotype.path, data.table = FALSE)
train.data$Y <- train.pheno[, 3]-1
train.data <- cbind(train.data[, feature.selection.result$index, drop = FALSE],
train.pheno[, covar.number + 2, drop = FALSE])
test.genotype.path <- file.path(input.dir, "test.raw")
test.genotype.path <- gsub('\\\\', '/', test.genotype.path)
test.phenotype.path <- file.path(input.dir, "test.phenotypes.txt")
test.phenotype.path <- gsub('\\\\', '/', test.phenotype.path)
test.data <- data.table::fread(test.genotype.path, data.table = FALSE)[, -c(1,2,3,4,5,6)]
colnames(test.data) <- unlist(purrr::map(colnames(test.data),function(x) {substr(x,1, nchar(x)-2)}))
test.pheno <- data.table::fread(test.phenotype.path, data.table = FALSE)
test.data$Y <- test.pheno[, 3]-1
test.data <- cbind(test.data[, feature.selection.result$index, drop = FALSE],
test.pheno[, covar.number + 2, drop = FALSE])
LR.pred <- LR.model(train.data, test.data)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.