Skip to main content

The NASA/GSFC network is currently experiencing intermittent issues that affect our services. We are working on it and apologize for the inconvenience.
The offline tool hark (also on github) can be used to find and download data from the cloud.

Xspec Home Page


bayes

set up for Bayesian inference

Syntax: bayes <option>
  bayes <mod par #> <prior type> [<hyperparameters>]

where <option> ::= [off |on |cons]. If a parameter number is given as the first argument then this command sets up the prior for the specified model parameter but does not turn Bayesian inference on. If the first argument to the bayes command is not a parameter number then one of the options off, on, or cons is used. The first two turn Bayesian inference off or on, while cons turns Bayesian inference on and gives all parameters a constant prior. The options for prior types are as follows:

Prior type Log(prior)      
cons 0      
exp $-p/h_1-\ln{(h_1)}$      
jeffreys $-\ln{(p)}$      
gauss $-0.5\ln{(2\pi h_2)}-0.5(h_1-p)^{2}/h_2^{2}$      
lognormal $-\ln{(p \sqrt{2\pi} h_2)} -0.5(\ln{(p)}-\ln{(h_1)})^{2}/h_2^{2}$      
gamma $h_1\ln{(h_2)} + (h_1-1) \ln{p} - h_2 p -
\ln{\Gamma(h_1)}$      
cauchy $-\ln{(1+(p-h_1)^2/h_2^2)} - \ln{\pi} - \ln{h_2}$      
beta $(h_1-1)\ln{x} + (h_2-1)\ln{(1-x)} - \ln{\Gamma(h_1+h_2)} -
\ln{\Gamma(h_1)} - \ln{\Gamma(h_2)}$      
studentst $\ln{\Gamma((h_1+1)/2)} - 0.5\ln{(h_1\pi)} -
\ln{\Gamma(h_1/2)} - ((h_1+2)/2)\ln{(1+p^2/h_1)}$      
halfnormal $-0.5\ln{(h_1^2\pi/2)} - p^2/(2h_1^2)$      
powerlaw $- p h_1$ for $h_2 \le p \le h_3$      
isotropic $\ln{(\sin{(p)})}$      
shiftedlognormal $-\ln{((p-h_1) \sqrt{2\pi} h_3)} -0.5(\ln{(p-h_1)}-\ln{(h_2)})^{2}/h_3^{2}$      

Where p is the parameter value, h$_{\char93 }$ the hyperparameter values, and for the beta prior x = (p-min)/(max-min) where min and max are the parameter hard limits.