/** * Computes the transformed y variable using the procedure outlined in the following paper: * * @see HA Chipman, EI George, and RE McCulloch. BART: Bayesian Additive Regressive Trees. The * Annals of Applied Statistics, 4(1): 266-298, 2010. */ protected void transformResponseVariable() { super.transformResponseVariable(); y_min = StatToolbox.sample_minimum(y_orig); y_max = StatToolbox.sample_maximum(y_orig); y_range_sq = Math.pow(y_max - y_min, 2); for (int i = 0; i < n; i++) { y_trans[i] = transform_y(y_orig[i]); } }
/** Computes <code>hyper_sigsq_mu</code> and <code>hyper_lambda</code>. */ protected void calculateHyperparameters() { hyper_mu_mu = 0; hyper_sigsq_mu = Math.pow(YminAndYmaxHalfDiff / (hyper_k * Math.sqrt(num_trees)), 2); if (sample_var_y == null) { sample_var_y = StatToolbox.sample_variance(y_trans); } // calculate lambda from q double ten_pctile_chisq_df_hyper_nu = 0; ChiSquaredDistributionImpl chi_sq_dist = new ChiSquaredDistributionImpl(hyper_nu); try { ten_pctile_chisq_df_hyper_nu = chi_sq_dist.inverseCumulativeProbability(1 - hyper_q); } catch (MathException e) { System.err.println( "Could not calculate inverse cum prob density for chi sq df = " + hyper_nu + " with q = " + hyper_q); System.exit(0); } hyper_lambda = ten_pctile_chisq_df_hyper_nu / hyper_nu * sample_var_y; }