.. index:: mdd .. _mdd: .. _marginalDataDensity: The properties =============== .. index:: mdd.log_post_kern .. _mdd.log_post_kern: log_post_kern -------------- mdd/log_post_kern is a property. .. index:: mdd.theta_draws .. _mdd.theta_draws: theta_draws ------------ mdd/theta_draws is a property. .. index:: mdd.lb .. _mdd.lb: lb --- mdd/lb is a property. .. index:: mdd.ub .. _mdd.ub: ub --- mdd/ub is a property. .. index:: mdd.maximization .. _mdd.maximization: maximization ------------- mdd/maximization is a property. .. index:: mdd.H .. _mdd.H: H -- Hessian used in the calculation of the laplace approximation. If not provided, finite differences will be used .. index:: mdd.subset .. _mdd.subset: subset ------- mdd/subset is a property. .. index:: mdd.thecoef .. _mdd.thecoef: thecoef -------- mdd/thecoef is a property. The methods ============ .. index:: mdd.bridge .. _mdd.bridge: bridge ------- BRIDGE Computes the log marginal data density using the "bridge" approximation by :cite:`MengWong96`. :: log_mdd=BRIDGE(obj) log_mdd=BRIDGE(obj,fix_point) log_mdd=BRIDGE(obj,fix_point,opts) Args: - **obj** [mdd]: Marginal Data Density object - **fix_point** [{true}\|false\|empty]: if true, optimization is done using a fix point algorithm. Else, an iterative strategy is used. - **opts** [empty\|struct]: options see help for mdd.global_options Returns: : - **log_mdd** [numeric]: log marginal data density - **extras** [struct]: history of log MDD and convergences at each iteration .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.laplace_mcmc, mdd.swz, mdd.global_options .. index:: mdd.cj .. _mdd.cj: cj --- CJ Computes the log marginal data density using the :cite:`ChibJeliazkov2001` approximation :: log_mdd=CJ(obj) log_mdd=CJ(obj,[],opts) Args: - **obj** [mdd]: Marginal Data Density object - **opts** [empty\|struct]: options see help for mdd.global_options Returns: : - **log_mdd** [numeric]: log marginal data density .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.ris, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz, mdd.global_options .. index:: mdd.global_options .. _mdd.global_options: global_options --------------- GLOBAL_OPTIONS : generic options for the control of computations for Marginal Data Density calculations. Key options include - **center_at_mean** [{false}\|true]: if true, in the calculation of moments, the covariance is centered at the mean, otherwise it is centered at the mode. - **L** [{500}\|empty\|integer]: number of extra draws - **debug** [{false}\|true]: displays certain messages for debugging purposes (algorithm specific) - **draws_are_iid** [{false}\|true]: - **mdd_bridge_TolFun** [{sqrt(eps)}\|positive scalar]: convergence tolerance for the bridge sampler's fixed-point loop. - **mdd_bridge_maxiter** [{1000}\|positive integer]: maximum number of iterations for the bridge sampler's fixed-point loop. .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz .. index:: mdd.is .. _mdd.is: is --- IS Computes the log marginal data density using the "importance sampling" approximation :: log_mdd=IS(obj) log_mdd=IS(obj,[],opts) Args: - **obj** [mdd]: Marginal Data Density object - **opts** [empty\|struct]: options see help for mdd.global_options Returns: : - **log_mdd** [numeric]: log marginal data density .. seealso:: mdd.laplace, mdd.mhm, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz, mdd.global_options .. index:: mdd.laplace .. _mdd.laplace: laplace -------- laplace Computes the log marginal data density :: log_mdd=laplace(obj) Args: - **obj** [mdd]: Marginal Data Density object Returns: : - **log_mdd** [numeric]: log marginal data density .. seealso:: mdd.mhm, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz .. index:: mdd.laplace_mcmc .. _mdd.laplace_mcmc: laplace_mcmc ------------- laplace_mcmc Computes the log marginal data density using the laplace approximation and a covariance matrix computed from the draws of posterior sampling :: log_mdd=laplace_mcmc(obj) Args: - **obj** [mdd]: Marginal Data Density object Returns: : - **log_mdd** [numeric]: log marginal data density .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.swz .. index:: mdd.laplace_mdd .. _mdd.laplace_mdd: laplace_mdd ------------ Computes the log marginal data density using the laplace approximation :: log_mdd=laplace_mdd(log_post,Hinv) Args: - **log_post** [numeric]: log of posterior kernel evaluated at the mode - **Hinv** [matrix]: inverse Hessian (negative of the second derivatives of the log posterior kernel) Returns: : - **log_mdd** [numeric]: log marginal data density .. index:: mdd.mdd .. _mdd.mdd: mdd ---- mdd : Constructor for marginal data density objects Syntax:: obj=mdd(theta_draws,log_post_kern,lb,ub) obj=mdd(theta_draws,log_post_kern,lb,ub,subset) obj=mdd(theta_draws,log_post_kern,lb,ub,subset,H) obj=mdd(theta_draws,log_post_kern,lb,ub,subset,H,maximization) Inputs - **theta_draws** [char\|struct]: sampling drawss => In case of a char, this is the location of the folder containing the draws organized as described below => In case of a structure, the fields are "f" and "x". Each parameter vector is defined as a structure, which means that theta_draws is a vector of structures. "x" is the parameter vector and "f" is the NEGATIVE of the log posterior kernel evaluated at "x". In case "f" is instead the log posterior kernel itself, option **maximization** below has to be set to "true". - **lb** [empty\|vector]: lower bound of the search space. Necessary only for the swz algorithm. Conveniently replaced with the lower bounds of theta_draws if empty. - **ub** [empty\|vector]: upper bound of the search space. Necessary only for the swz algorithm. Conveniently replaced with the upper bounds of theta_draws if empty. - **subset** (cell array\|{empty}): When not empty, subset is a 1 x 2 cell array in which the first cell contains a vector selecting the columns to retain in each chain and the second column contains the chains retained. Any or both of those cell array containts can be empty. Whenever an entry is empty, all the information available is selected. E.g. subsetting with dropping and trimming mysubs={a:b:c,[1,3,5]}. In this example, the first element selected is the one in position "a" and thereafter every "b" element is selected until we reach element in position "c". At the same time, we select markov chains 1,3 and 5. - **H** [empty\|matrix]: Hessian matrix for the parameters Necessary only for the laplace algorithm. If left empty, finite differences are used. - **maximization** [{false}\|true\|empty]: Informs the procedure about whether we have a maximization or a minimization problem. .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz .. index:: mdd.mhm .. _mdd.mhm: mhm ---- mhm Computes the log marginal data density using the "modified harmonic mean" approximation by :cite:`Geweke1999`. :: log_mdd=mhm(obj) Args: - **obj** [mdd]: Marginal Data Density object - **mhm_tau** [{(.1:.1:.9)}\|vector\|scalar\|empty]: truncation probabilities - **opts** [empty\|struct]: options see help for mdd.global_options Returns: - **log_mdd** [numeric]: log marginal data density .. seealso:: mdd.laplace, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz, mdd.global_options .. index:: mdd.mueller .. _mdd.mueller: mueller -------- MUELLER Computes the log marginal data density using the Ulrich Mueller's approximation :: log_mdd=MUELLER(obj) log_mdd=MUELLER(obj,[],opts) Args: - **obj** [mdd]: Marginal Data Density object - **opts** [empty\|struct]: options see help for mdd.global_options Returns: - **log_mdd** [numeric]: log marginal data density .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz, mdd.global_options .. index:: mdd.normal_weighting .. _mdd.normal_weighting: normal_weighting ----------------- mdd.normal_weighting is a function. [loglik, v_iF_v, lik] = mdd.normal_weighting(v, det_Sigma, Sigma_i) .. index:: mdd.ris .. _mdd.ris: ris ---- RIS Computes the log marginal data density using the "Reciprocal Importance Sampling" approximation as in :cite:`FRUE2006` :: log_mdd=RIS(obj) log_mdd=RIS(obj,[],opts) Args: - **obj** [mdd]: Marginal Data Density object - **opts** [empty\|struct]: options see help for mdd.global_options Returns: - **log_mdd** [numeric]: log marginal data density .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.swz, mdd.global_options .. index:: mdd.swz .. _mdd.swz: swz ---- SWZ Computes the log marginal data density using the :cite:`SimsWZ2008` approximation :: log_mdd=SWZ(obj) log_mdd=SWZ(obj,swz_pvalue) log_mdd=SWZ(obj,swz_pvalue,opts) Args: - **obj** [mdd]: Marginal Data Density object - **swz_pvalue** [{90}\|empty\|scalar]: scalar for the computation of the lower bound. Must be greater than 0 and less than 100 - **opts** [empty\|struct]: options see help for mdd.global_options Returns: : - **log_mdd** [numeric]: log marginal data density - **extras** [struct]: lower bound and corresponding quantile .. seealso:: mdd.laplace, mdd.mhm, mdd.is, mdd.ris, mdd.cj, mdd.mueller, mdd.bridge, mdd.laplace_mcmc, mdd.global_options