|
64 | 64 | #' @export
|
65 | 65 | "BayesTreePriorOrthogonalInf"
|
66 | 66 |
|
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). |
69 | 69 | #' @param alpha base parameter of the tree prior, \eqn{\alpha \in [0,1)}.
|
70 | 70 | #' @param beta power parameter of the tree prior, \eqn{beta \geq 0}.
|
71 | 71 | #' @param x_size number of possible splits, \eqn{x_{size}>0}.
|
|
77 | 77 | #' @export
|
78 | 78 | "NumBotMaxDepth"
|
79 | 79 |
|
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). |
82 | 82 | #' @param alpha base parameter of the tree prior, \eqn{\alpha \in [0,1)}.
|
83 | 83 | #' @param beta power parameter of the tree prior, \eqn{beta \geq 0}.
|
84 | 84 | #' @param n_obs number of unique observations, \eqn{n_{obs}>1}.
|
|
111 | 111 | #' @param beta power parameter of the tree prior, \eqn{beta \geq 0}.
|
112 | 112 | #' @param X data.frame of the design matrix.
|
113 | 113 | #' @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}. |
115 | 115 | #' @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.
|
116 | 116 | #' @param MIA set to TRUE if you want Missing Incorporated in Attributes (MIA) imputation to be used.
|
117 | 117 | #' @param missingdummy set to TRUE if you have dummy coded the NAs.
|
|
139 | 139 | #' @param beta power parameter of the tree prior, \eqn{\beta \geq 0}.
|
140 | 140 | #' @param X data.frame of the design matrix.
|
141 | 141 | #' @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}. |
143 | 143 | #' @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.
|
144 | 144 | #' @param MIA set to TRUE if you want Missing Incorporated in Attributes (MIA) imputation to be used.
|
145 | 145 | #' @param missingdummy set to TRUE if you have dummy coded the NAs.
|
|
165 | 165 | #' \itemize{
|
166 | 166 | #' \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}}
|
167 | 167 | #' \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)} |
169 | 169 | #' \item{Case #4: }{General case}
|
170 | 170 | #' }
|
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. |
172 | 172 | #'
|
173 | 173 | #' @param alpha base parameter of the tree prior, \eqn{\alpha \in [0,1)}.
|
174 | 174 | #' @param beta power parameter of the tree prior, \eqn{\beta \geq 0}.
|
175 | 175 | #' @param X data.frame of the design matrix (Required for case #4).
|
176 | 176 | #' @param n_iter number of trees to generate, \eqn{n_{iter}>0} (Used for case #2, #3 or #4).
|
177 | 177 | #' @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}. |
179 | 179 | #' @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).
|
180 | 180 | #' @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.
|
181 | 181 | #' @param MIA set to TRUE if you want Missing Incorporated in Attributes (MIA) imputation to be used.
|
|
186 | 186 | #' results1 = BayesTreePrior(.45,0)
|
187 | 187 | #' #Case 2 : Unrealistic case where we assume that the number of var/obs is infinite
|
188 | 188 | #' results2 = BayesTreePrior(.95,.5)
|
189 |
| -#' #Case 3 : Design matrix X is orthogonal |
| 189 | +#' #Case 3 : One variable with a finite number of observations |
190 | 190 | #' results3 = BayesTreePrior(.95,.5,n_obs=150)
|
191 | 191 | #' if (requireNamespace("MASS", quietly = TRUE)) {
|
192 | 192 | #' #Case 4 : General case, without missing data
|
|
212 | 212 | #'
|
213 | 213 | #' 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.
|
214 | 214 | #'
|
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. |
216 | 216 | #' @import stats
|
217 | 217 | #' @export
|
218 | 218 | "BayesTreePrior"
|
@@ -483,19 +483,19 @@ BayesTreePrior = function(alpha, beta, X=NULL, n_obs=NULL, n_iter=500, minpart=1
|
483 | 483 | }
|
484 | 484 | else{
|
485 | 485 | # 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") |
487 | 487 | message("Ignored arguments : min_part, pvars, MIA, missingdummy")
|
488 | 488 | return(BayesTreePriorOrthogonal(alpha, beta, n_obs, n_iter))
|
489 | 489 | }
|
490 | 490 | }
|
491 | 491 | else{
|
492 | 492 | 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") |
494 | 494 | message("Ignored arguments : min_part, pvars, MIA, missingdummy")
|
495 | 495 | return(BayesTreePriorOrthogonal(alpha, beta, n_obs=length(GetListUniqueSplits(X))))
|
496 | 496 | }
|
497 | 497 | 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") |
499 | 499 | message("Ignored arguments : min_part, pvars, MIA, missingdummy")
|
500 | 500 | return(BayesTreePriorOrthogonal(alpha, beta, n_obs=length(GetListUniqueSplits(as.vector(as.matrix(X))))))
|
501 | 501 | }
|
|
0 commit comments