family_of_distributions
[source]
family_of_distributions
(distribution_name
,get_info
, *varargin
)
For each of the family of distributions this script performs specific computations like number of pdf/pmf, etc.
This function contains the probability density computation, the distribution-specific fminunc to optimize the objective function, and the associated partial derivatives for each of the dependent-variable distributions that are currently covered by the toolbox (i.e., Bernoulli, normal)
Arguments:
- distribution_name: distribution name, string, e.g. 'bernoulli', 'normal'
- get_info: Cues for specific information / computation, string, e.g. 'get_nParams'
- varargin: Is either empty or has arguments depending on the computation
Returns output of all computations.
bernoulli_distribution
[source]
bernoulli_distribution
(get_info
,input_params
)
If get_info is compute_densities
, computes the log probability
densities of the curves specified by input_params using the bernoulli
distribution. Otherwise passes parameters to fminunc_both_betas
.
fminunc_bernoulli_both
[source]
fminunc_bernoulli_both
(betas
,w
,net_effects
,dependent_var
)
Optimizes logistic regression betas using bernoulli cost function F
Arguments:
- betas: The current betas that were used to compute likelihoods
- w: Weight vector that holds the normalized weights for P particles
- net_effects: Predictor variable Matrix (number of trials x particles)
- dependent_var: Dependent variable Matrix (number of trials x 1)
Returns:
- f: Scalar, Objective function
- g: Vector of length 2 i.e. gradients with respect to beta_0 and beta_1
normal_distribution
[source]
normal_distribution
(get_info
,input_params
)
If get_info is compute_densities
, computes the log probability
densities of the curves specified by input_params using the normal
distribution. Otherwise passes parameters to fminunc_normal_both
.
fminunc_normal_both
[source]
fminunc_normal_both
(betas
,w
,net_effects
,dependent_var
,dist_specific_params
)
Optimizes logistic regression betas using normal cost function F
Arguments:
- betas: The current betas that were used to compute likelihoods
- w: Weight vector that holds the normalized weights for P particles
- net_effects: Predictor variable Matrix (number of trials x particles)
- dependent_var: Dependent variable Matrix (number of trials x 1)
- sigma: Used to specify variance in the Normal distribution
Returns:
- f: Scalar, Objective function
- g: Vector of length 2 i.e. gradients with respect to beta_0 and beta_1