Skip to content

Commit 6983716

Browse files
authored
Add files via upload
Updated documentation.
1 parent dde4def commit 6983716

7 files changed

+34
-35
lines changed

DESCRIPTION

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
Package: BayesTreePrior
22
Title: Bayesian Tree Prior Simulation
3-
Version: 1.0
4-
Date: 2016-04-15
3+
Version: 1.0.1
4+
Date: 2016-06-27
55
Author: Alexia Jolicoeur-Martineau <[email protected]>
66
Maintainer: Alexia Jolicoeur-Martineau <[email protected]>
7-
Description: Provides a way to simulate from the prior distribution of Bayesian trees by Chipman et al. (1998) <DOI:10.2307/2669832>. The prior distribution of Bayesian trees is highly dependent on the design matrix X, therefore using the suggested hyperparameters by Chipman et al. (1998) <DOI:10.2307/2669832> is not recommended and could lead to unexpected prior distribution. This work is part of my master thesis (In revision, expected 2016) and a journal publication I'm working on.
7+
Description: Provides a way to simulate from the prior distribution of Bayesian trees by Chipman et al. (1998) <DOI:10.2307/2669832>. The prior distribution of Bayesian trees is highly dependent on the design matrix X, therefore using the suggested hyperparameters by Chipman et al. (1998) <DOI:10.2307/2669832> is not recommended and could lead to unexpected prior distribution. This work is part of my master thesis (expected 2016).
88
License: GPL-3
9-
Imports:
10-
stats
11-
Suggests:
12-
tgp,
13-
BayesTree,
14-
bartMachine,
15-
MASS
9+
Imports: stats
10+
Suggests: tgp, BayesTree, bartMachine, MASS
1611
RoxygenNote: 5.0.1
12+
NeedsCompilation: no
13+
Packaged: 2016-06-27 17:38:55 UTC; Emiaz
14+
Repository: CRAN
15+
Date/Publication: 2016-04-18 08:45:38

R/BayesTreePrior.R

+14-14
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
#' @export
6565
"BayesTreePriorOrthogonalInf"
6666

67-
#' @title Number of bottom nodes and depth in the case where the design matrix X is orthogonal (Case #3).
68-
#' @description Generate a tree and returns the number of bottom nodes and depth in the case where the design matrix X is orthogonal (Case #3).
67+
#' @title Number of bottom nodes and depth in the case where we have one single variable (Case #3).
68+
#' @description Generate a tree and returns the number of bottom nodes and depth in the case where we have one variable with a finite number of observations (Case #3).
6969
#' @param alpha base parameter of the tree prior, \eqn{\alpha \in [0,1)}.
7070
#' @param beta power parameter of the tree prior, \eqn{beta \geq 0}.
7171
#' @param x_size number of possible splits, \eqn{x_{size}>0}.
@@ -77,8 +77,8 @@
7777
#' @export
7878
"NumBotMaxDepth"
7979

80-
#' @title Simulation of the tree prior in the case where the design matrix X is orthogonal (Case #3).
81-
#' @description Generate \eqn{n_{iter}} trees from the prior distribution in the case where the design matrix X is orthogonal (Case #3).
80+
#' @title Simulation of the tree prior in the case where we have one single variable (Case #3).
81+
#' @description Generate \eqn{n_{iter}} trees from the prior distribution in the case where we have one variable with a finite number of observations (Case #3).
8282
#' @param alpha base parameter of the tree prior, \eqn{\alpha \in [0,1)}.
8383
#' @param beta power parameter of the tree prior, \eqn{beta \geq 0}.
8484
#' @param n_obs number of unique observations, \eqn{n_{obs}>1}.
@@ -111,7 +111,7 @@
111111
#' @param beta power parameter of the tree prior, \eqn{beta \geq 0}.
112112
#' @param X data.frame of the design matrix.
113113
#' @param depth depth of the current node, \eqn{depth \geq 0}.
114-
#' @param minpart the minimum number of bottom nodes required in one of the child to be able to split, \eqn{minpart>0}.
114+
#' @param minpart the minimum number of observations required in one of the child to be able to split, \eqn{minpart>0}.
115115
#' @param pvars vector of probabilities for the choices of variables to split (Will automatically be normalized so that the sum equal to 1). It must be twice as large as the number of variables when \eqn{missingdummy} is TRUE.
116116
#' @param MIA set to TRUE if you want Missing Incorporated in Attributes (MIA) imputation to be used.
117117
#' @param missingdummy set to TRUE if you have dummy coded the NAs.
@@ -139,7 +139,7 @@
139139
#' @param beta power parameter of the tree prior, \eqn{\beta \geq 0}.
140140
#' @param X data.frame of the design matrix.
141141
#' @param n_iter number of trees to generate, \eqn{n_{iter}>0}.
142-
#' @param minpart the minimum number of bottom nodes required in one of the child to be able to split, \eqn{minpart>0}.
142+
#' @param minpart the minimum number of observations required in one of the child to be able to split, \eqn{minpart>0}.
143143
#' @param pvars vector of probabilities for the choices of variables to split (Will automatically be normalized so that the sum equal to 1). It must be twice as large as the number of variables when \eqn{missingdummy} is TRUE.
144144
#' @param MIA set to TRUE if you want Missing Incorporated in Attributes (MIA) imputation to be used.
145145
#' @param missingdummy set to TRUE if you have dummy coded the NAs.
@@ -165,17 +165,17 @@
165165
#' \itemize{
166166
#' \item{Case #1: }{Unrealistic case where we assume that the number of variables and possible splits are infinite (therefore \eqn{P(T)} is not dependent on the design matrix X) and \eqn{\beta=0}}
167167
#' \item{Case #2: }{Unrealistic case where we assume that the number of variables and possible splits are infinite (therefore \eqn{P(T)} is not dependent on the design matrix X)}
168-
#' \item{Case #3: }{Design matrix X is orthogonal}
168+
#' \item{Case #3: }{One variable with a finite number of observations (Seems to be equivalent to the multiple variables case when all variables are continuous)}
169169
#' \item{Case #4: }{General case}
170170
#' }
171-
#' Case #1 will be used if no design matrix X or number of observations is given and \eqn{\beta = 0}. Case #2 will be used if no design matrix X or number of observations is given and \eqn{\beta \neq 0}. Case #3 will be used if no design matrix X is given but the number of observations is given. Case #4 will be used if the design matrix X is given. Note that case #4 is always slower, so if your design matrix is orthogonal, it would be advisable to enter the number of uniques observations rather than the design matrix X, to be able to use case #3.
171+
#' Case #1 will be used if no design matrix X or number of observations is given and \eqn{\beta = 0}. Case #2 will be used if no design matrix X or number of observations is given and \eqn{\beta \neq 0}. Case #3 will be used if no design matrix X is given but the number of observations is given. Case #4 will be used if the design matrix X is given. Note that case #4 is always slower, so if all your variables are continuous, it would be advisable to enter the number of uniques observations rather than the design matrix X, to be able to use case #3.
172172
#'
173173
#' @param alpha base parameter of the tree prior, \eqn{\alpha \in [0,1)}.
174174
#' @param beta power parameter of the tree prior, \eqn{\beta \geq 0}.
175175
#' @param X data.frame of the design matrix (Required for case #4).
176176
#' @param n_iter number of trees to generate, \eqn{n_{iter}>0} (Used for case #2, #3 or #4).
177177
#' @param n_obs number of unique observations, \eqn{n_{obs}>1} (Required for case #3).
178-
#' @param minpart the minimum number of bottom nodes required in one of the child to be able to split, \eqn{minpart>0}.
178+
#' @param minpart the minimum number of observations required in one of the child to be able to split, \eqn{minpart>0}.
179179
#' @param package a optional string that can take the following values : "BayesTree", "tgp" or "bartMachine". It forces the algorithm to use the default paramameters used by the package specified (\eqn{minpart=5} for BayesTree, \eqn{minpart = max(c(10,dim(X)[2]+1))} for tgp and \eqn{minpart=1} for bartMachine).
180180
#' @param pvars vector of probabilities for the choices of variables to split (Will automatically be normalized so that the sum equal to 1). It must be twice as large as the number of variables when \eqn{missingdummy} is TRUE.
181181
#' @param MIA set to TRUE if you want Missing Incorporated in Attributes (MIA) imputation to be used.
@@ -186,7 +186,7 @@
186186
#' results1 = BayesTreePrior(.45,0)
187187
#' #Case 2 : Unrealistic case where we assume that the number of var/obs is infinite
188188
#' results2 = BayesTreePrior(.95,.5)
189-
#' #Case 3 : Design matrix X is orthogonal
189+
#' #Case 3 : One variable with a finite number of observations
190190
#' results3 = BayesTreePrior(.95,.5,n_obs=150)
191191
#' if (requireNamespace("MASS", quietly = TRUE)) {
192192
#' #Case 4 : General case, without missing data
@@ -212,7 +212,7 @@
212212
#'
213213
#' Twala, B. E. T. H., Jones, M. C., & Hand, D. J. (2008). \emph{Good methods for coping with missing data in decision trees.} Pattern Recognition Letters, 29(7), 950-956.
214214
#'
215-
#' Jolicoeur-Martineau, A. (Currently in revision, expected 2016) \emph{Etude d'une loi a priori pour les arbres binaires de regression} (\emph{Study on the prior distribution of binary regression trees}) (Master thesis). UQAM university.
215+
#' Jolicoeur-Martineau, A. (expected 2016) \emph{Etude d'une loi a priori pour les arbres binaires de regression} (\emph{Study on the prior distribution of binary regression trees}) (Master thesis). UQAM university.
216216
#' @import stats
217217
#' @export
218218
"BayesTreePrior"
@@ -483,19 +483,19 @@ BayesTreePrior = function(alpha, beta, X=NULL, n_obs=NULL, n_iter=500, minpart=1
483483
}
484484
else{
485485
# Add check for orthogonality on X for this case;
486-
message("Case 3 -> The design matrix is orthogonal")
486+
message("Case 3 -> One variable with a finite number of observations")
487487
message("Ignored arguments : min_part, pvars, MIA, missingdummy")
488488
return(BayesTreePriorOrthogonal(alpha, beta, n_obs, n_iter))
489489
}
490490
}
491491
else{
492492
if(is.vector(X) && minpart==1 && is.null(pvars) && MIA==FALSE){
493-
message("Case 3 -> The design matrix is orthogonal")
493+
message("Case 3 -> One variable with a finite number of observations")
494494
message("Ignored arguments : min_part, pvars, MIA, missingdummy")
495495
return(BayesTreePriorOrthogonal(alpha, beta, n_obs=length(GetListUniqueSplits(X))))
496496
}
497497
if(dim(X)[2] == 1 && minpart==1 && is.null(pvars) && MIA==FALSE){
498-
message("Case 3 -> The design matrix is orthogonal")
498+
message("Case 3 -> One variable with a finite number of observations")
499499
message("Ignored arguments : min_part, pvars, MIA, missingdummy")
500500
return(BayesTreePriorOrthogonal(alpha, beta, n_obs=length(GetListUniqueSplits(as.vector(as.matrix(X))))))
501501
}

man/BayesTreePrior.Rd

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/BayesTreePriorNotOrthogonal.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/BayesTreePriorOrthogonal.Rd

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/NumBotMaxDepth.Rd

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/NumBotMaxDepthX.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)