mirror of
https://github.com/prise6/aVirtualTwins.git
synced 2024-05-20 22:36:32 +02:00
Make example checkable + delete import rpart function
This commit is contained in:
parent
bcdb2dc1c3
commit
e1355147ea
|
@ -32,23 +32,24 @@
|
||||||
#' @return \code{VT.difft}
|
#' @return \code{VT.difft}
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
#' \dontrun{
|
#'
|
||||||
#' # data(sepsis)
|
#' data(sepsis)
|
||||||
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
||||||
#' # inside model :
|
#' # inside model :
|
||||||
#' vt.f <- vt.forest("one", vt.o)
|
#' vt.f <- vt.forest("one", vt.o)
|
||||||
#' # ...
|
#' # ...
|
||||||
#' # your model :
|
#' # your model :
|
||||||
#' rf <- randomForest(y = vt.o$getY(),
|
#' # library(randomForest)
|
||||||
#' x = vt.o$getX(int = T),
|
#' # rf <- randomForest(y = vt.o$getY(),
|
||||||
#' mtry = 3,
|
#' # x = vt.o$getX(int = T),
|
||||||
#' nodesize = 15)
|
#' # mtry = 3,
|
||||||
#' vt.f <- vt.forest("one", vt.o, model = rf)
|
#' # nodesize = 15)
|
||||||
|
#' # vt.f <- vt.forest("one", vt.o, model = rf)
|
||||||
#' # ...
|
#' # ...
|
||||||
#' # Can also use ... parameters
|
#' # Can also use ... parameters
|
||||||
#' vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
|
#' vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
|
||||||
#' # ...
|
#' # ...
|
||||||
#' }
|
#'
|
||||||
#'
|
#'
|
||||||
#' @include forest.R difft.R
|
#' @include forest.R difft.R
|
||||||
#'
|
#'
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#' \dontrun{
|
#' \dontrun{
|
||||||
#' data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
|
#' data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
|
||||||
#' }
|
#' }
|
||||||
|
#' data(sepsis)
|
||||||
|
#' data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T)
|
||||||
|
#'
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
#' @param ... parameters of \code{\link{VT.object}}
|
#' @param ... parameters of \code{\link{VT.object}}
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
#' \dontrun{
|
#'
|
||||||
#' data(sepsis)
|
#' data(sepsis)
|
||||||
#' formatRCTdataset(sepsis, "survival", "THERAPY", T)
|
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
||||||
#' }
|
|
||||||
#'
|
#'
|
||||||
#' @return \code{VT.object}
|
#' @return \code{VT.object}
|
||||||
#'
|
#'
|
||||||
|
@ -25,6 +24,8 @@
|
||||||
#' @name vt.data
|
#' @name vt.data
|
||||||
#'
|
#'
|
||||||
#' @export vt.data
|
#' @export vt.data
|
||||||
|
#'
|
||||||
|
#' @seealso \code{\link{formatRCTDataset}}
|
||||||
|
|
||||||
vt.data <- function(dataset, outcome.field, treatment.field, interactions = TRUE, ...){
|
vt.data <- function(dataset, outcome.field, treatment.field, interactions = TRUE, ...){
|
||||||
data <- formatRCTDataset(dataset, outcome.field, treatment.field, interactions = TRUE)
|
data <- formatRCTDataset(dataset, outcome.field, treatment.field, interactions = TRUE)
|
||||||
|
|
10
R/tools.R
10
R/tools.R
|
@ -18,18 +18,16 @@
|
||||||
#' @return data.frame of rules
|
#' @return data.frame of rules
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
#' \dontrun{
|
#' data(sepsis)
|
||||||
#' # data(sepsis)
|
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", TRUE)
|
||||||
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
|
||||||
#' # inside model :
|
#' # inside model :
|
||||||
#' vt.f <- vt.forest("one", vt.o)
|
#' vt.f <- vt.forest("one", vt.o)
|
||||||
#' # use classification tree
|
#' # use classification tree
|
||||||
#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
|
#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
|
||||||
#' # show subgroups
|
#' # show subgroups
|
||||||
#' vt.subgroups(vt.tr)
|
#' subgroups <- vt.subgroups(vt.tr)
|
||||||
#' # change options you'll be surprised !
|
#' # change options you'll be surprised !
|
||||||
#' vt.subgroups(vt.tr, verbose = T, tables = T)
|
#' subgroups <- vt.subgroups(vt.tr, verbose = TRUE, tables = TRUE)
|
||||||
#' }
|
|
||||||
#'
|
#'
|
||||||
#' @export vt.subgroups
|
#' @export vt.subgroups
|
||||||
#'
|
#'
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#' @export VT.tree.class
|
#' @export VT.tree.class
|
||||||
#'
|
#'
|
||||||
#' @import methods
|
#' @import methods
|
||||||
#' @importFrom rpart rpart
|
#'
|
||||||
VT.tree.class <- setRefClass(
|
VT.tree.class <- setRefClass(
|
||||||
Class = "VT.tree.class",
|
Class = "VT.tree.class",
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
#' dimension. See examples.
|
#' dimension. See examples.
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
#' \dontrun{
|
#' data(sepsis)
|
||||||
#' # data(sepsis)
|
|
||||||
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
||||||
#' # inside model :
|
#' # inside model :
|
||||||
#' vt.f <- vt.forest("one", vt.o)
|
#' vt.f <- vt.forest("one", vt.o)
|
||||||
|
@ -34,11 +33,12 @@
|
||||||
#' # return a list
|
#' # return a list
|
||||||
#' class(vt.tr)
|
#' class(vt.tr)
|
||||||
#' # access one of the tree
|
#' # access one of the tree
|
||||||
#' vt.tr$tree1
|
#' tree1 <- vt.tr$tree1
|
||||||
#' # return infos
|
#' # return infos
|
||||||
#' vt.tr$tree1$getInfos()
|
#' # vt.tr$tree1$getInfos()
|
||||||
#' # ...
|
#' # vt.tr$tree1$getRules()
|
||||||
#' }
|
#' # use vt.subgroups tool:
|
||||||
|
#' subgroups <- vt.subgroups(vt.tr)
|
||||||
#'
|
#'
|
||||||
#' @include tree.R
|
#' @include tree.R
|
||||||
#'
|
#'
|
||||||
|
|
|
@ -16,15 +16,6 @@ aVirtualTwins is written mainly with reference classes. Briefly, there is three
|
||||||
\code{\link{vt.tree}} is users function.
|
\code{\link{vt.tree}} is users function.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\section{TODO LIST}{
|
\details{
|
||||||
|
See http://github.com/prise6/aVirtualTwins for last updates.
|
||||||
\emph{last update : 27.07.2015}
|
|
||||||
\itemize{
|
|
||||||
\item More detailed documentation and vignettes
|
|
||||||
\item Write examples
|
|
||||||
\item ...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
See github.com/prise6/aVirtualTwins for last updates.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,9 @@ running VirtualTwins with interaction, it creates dummy variables.
|
||||||
\dontrun{
|
\dontrun{
|
||||||
data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
|
data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
|
||||||
}
|
}
|
||||||
|
data(sepsis)
|
||||||
|
data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,11 @@ interactions, set to TRUE (default value)}
|
||||||
a VT.object object.
|
a VT.object object.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
\dontrun{
|
|
||||||
data(sepsis)
|
data(sepsis)
|
||||||
formatRCTdataset(sepsis, "survival", "THERAPY", T)
|
vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
\seealso{
|
||||||
|
\code{\link{formatRCTDataset}}
|
||||||
|
}
|
||||||
|
|
|
@ -50,22 +50,23 @@ Is only used with forest.type = "fold". Default to 5. See
|
||||||
parameter forest.type, any of these class can be used with its own parameter.
|
parameter forest.type, any of these class can be used with its own parameter.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
\dontrun{
|
|
||||||
# data(sepsis)
|
data(sepsis)
|
||||||
vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
||||||
# inside model :
|
# inside model :
|
||||||
vt.f <- vt.forest("one", vt.o)
|
vt.f <- vt.forest("one", vt.o)
|
||||||
# ...
|
# ...
|
||||||
# your model :
|
# your model :
|
||||||
rf <- randomForest(y = vt.o$getY(),
|
# library(randomForest)
|
||||||
x = vt.o$getX(int = T),
|
# rf <- randomForest(y = vt.o$getY(),
|
||||||
mtry = 3,
|
# x = vt.o$getX(int = T),
|
||||||
nodesize = 15)
|
# mtry = 3,
|
||||||
vt.f <- vt.forest("one", vt.o, model = rf)
|
# nodesize = 15)
|
||||||
|
# vt.f <- vt.forest("one", vt.o, model = rf)
|
||||||
# ...
|
# ...
|
||||||
# Can also use ... parameters
|
# Can also use ... parameters
|
||||||
vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
|
vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
|
||||||
# ...
|
# ...
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,17 +32,15 @@ Function which uses \code{\link{VT.tree}} intern functions. Package
|
||||||
rpart.plot must be loaded. See \code{\link{VT.tree}} for details.
|
rpart.plot must be loaded. See \code{\link{VT.tree}} for details.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
\dontrun{
|
data(sepsis)
|
||||||
# data(sepsis)
|
vt.o <- vt.data(sepsis, "survival", "THERAPY", TRUE)
|
||||||
vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
|
||||||
# inside model :
|
# inside model :
|
||||||
vt.f <- vt.forest("one", vt.o)
|
vt.f <- vt.forest("one", vt.o)
|
||||||
# use classification tree
|
# use classification tree
|
||||||
vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
|
vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
|
||||||
# show subgroups
|
# show subgroups
|
||||||
vt.subgroups(vt.tr)
|
subgroups <- vt.subgroups(vt.tr)
|
||||||
# change options you'll be surprised !
|
# change options you'll be surprised !
|
||||||
vt.subgroups(vt.tr, verbose = T, tables = T)
|
subgroups <- vt.subgroups(vt.tr, verbose = TRUE, tables = TRUE)
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,7 @@ See \code{\link{VT.tree}}, \code{\link{VT.tree.class}} and
|
||||||
\code{\link{VT.tree.reg}} classes.
|
\code{\link{VT.tree.reg}} classes.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
\dontrun{
|
data(sepsis)
|
||||||
# data(sepsis)
|
|
||||||
vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
|
||||||
# inside model :
|
# inside model :
|
||||||
vt.f <- vt.forest("one", vt.o)
|
vt.f <- vt.forest("one", vt.o)
|
||||||
|
@ -49,10 +48,11 @@ See \code{\link{VT.tree}}, \code{\link{VT.tree.class}} and
|
||||||
# return a list
|
# return a list
|
||||||
class(vt.tr)
|
class(vt.tr)
|
||||||
# access one of the tree
|
# access one of the tree
|
||||||
vt.tr$tree1
|
tree1 <- vt.tr$tree1
|
||||||
# return infos
|
# return infos
|
||||||
vt.tr$tree1$getInfos()
|
# vt.tr$tree1$getInfos()
|
||||||
# ...
|
# vt.tr$tree1$getRules()
|
||||||
}
|
# use vt.subgroups tool:
|
||||||
|
subgroups <- vt.subgroups(vt.tr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue