Difference between revisions of "Coding distributions for use in Rave"
(Created page with "To create a new distribution, make a new folder under rave\distributions\ whose name is the KEYWORD that identifies your distribution. See below for the limitations on how you...")
Revision as of 12:56, 14 October 2014
To create a new distribution, make a new folder under rave\distributions\ whose name is the KEYWORD that identifies your distribution. See below for the limitations on how you must code this distribution, in particular the requirement to use the inverse-transform sampling method.
Inside this folder, you must place the following files:
- distributioninfo.txt - A two-line text file. The first line contains a (short) name for this distribution. The second line contains a slightly longer description of the distribution.
- distributionsettingsKEYWORD.m - a SCRIPT that creates a scalar structure named "settings" whose fields are the settings/parameters that define this distribution. Rave will display both the field names and values to the user, so make the fieldnames meaningful.
- distributionsampleKEYWORD.m - an inverse-cdf function that returns x given y such that y=P(x). Must have the signature: x=distributionsamplenormal(settings,y). Where n is a scalar number of points to sample, settings is the settings structure, and yis a vector of length n numbers between 0 and 1. In practice, Rave will construct the y vector depending on the user's desired sampling method (e.g. random or quasi-monte carlo).
- distributionfitdataKEYWORD.m(optional) - A function that creates this distribution from a vector of data. Must have the signature: settings=distributionfitdataKEYWORD(data,settings). The input settings structure will be the default settings (in case this function does not recalculate all of the settings). If this function does not exist then Rave won't let users create your distribution automatically from data.