Negative binomial dispersion parameter in Matlab - r

The matlab function nbinfit returns the values r and p for the negative binomial. Is there an equivalent MLE function in matlab that instead returns the values for mu (mean) and theta (the dispersion parameter) for the "ecological" or "Polya" parametrization of the negative binomial?
(something like fitdistr in R)

Related

R GLM weights implementation /interpretation

Implementing a GLM in R with weights.
I am wondering whether this quote from R Documentation of GLM
Non-NULL weights can be used to indicate that different observations have different dispersions (with the values in weights being inversely proportional to the dispersions); or equivalently, when the elements of weights are positive integers , that each response is the mean of unit-weight observations.
means that the log-likelihood is modified in the following way
\sum_{i} \log f(X_i) \to \sum_{i} w_i \log f(X_i)
only when the weights are positive integers?
If this is not possible at all then how do I incorporate weights in the way as described in the formula?

How to use the gamma distribution equation

I am using R to fit a GLM with Gamma distribution (link inverse). I would like to use the equation of the model to get other values of my predictors, knowing the response value. I know that the equation of a gamma distribution with link inverse is 1/ΞΌ = b0 + b1x1i, can you confirm that I should substitute to ΞΌ the mean of my response value?

How to get regularization parameter given by πœ† = 𝛼/𝛽 in MAP

maximizing the posterior distribution is equivalent to minimizing the regularized sum-of-squares error function with a regularization parameter given by πœ† = 𝛼/𝛽.
Maximizing the posterior distribution is equivalent to minimizing the regularized sum-of-squares error function
𝐸 ̃(𝐰)= 1/2 βˆ‘(𝑛=1)^𝑁▒{𝑦〖(π‘₯〗𝑛, 𝐰)βˆ’π‘‘_𝑛 }^2 +πœ†/2 ‖𝐰‖^2
where
‖𝐰‖^2 ≑𝐰^T 𝐰= 𝑀_0^2+𝑀1^2+…+𝑀𝑀^2
with a regularization parameter given by πœ† = 𝛼/𝛽.

How to represent hypothesis function in logistic regression cost function

Below is logistic regression cost function with features(x) , training examples(y)
How should the hypotheses function (circled red) be represented ? :
I'm attempting to implement this function but unsure what value (or function) the hypothesis should take ?
The activation function in logistic regression is the sigmoid function (https://en.wikipedia.org/wiki/Sigmoid_function), defined as
which is also probability of y taking on a 1 value for a given x and parameter theta's to be determined (sigmoid is always between 0 and 1)
The cost function you mentioned comes from maximum likelihood estimation (https://en.wikipedia.org/wiki/Maximum_likelihood) of training (X, y) pairs. The log-likelihood of any (X, y) pair is exactly
The final loss function is precisely the sum of all log-likelihood for all (X, y) training pairs.
Thus, the ''hypothesis" you are talking about is simply sigmoid, 1/(1+exp(-theta * x)) (actually I am not familiar with the term hypothesis used in this context, but the expression resembles any standard expression involving sigmoid and MLE)

What is the equivalent R function to GAMMA.INV(probability,alpha,beta) Excel function?

I need to find the inverse of the gamma cumulative distribution. I know there is GAMMA.INV(probability,alpha,beta) function just to do that in excel. How can I achieve this in R language?
In R, for most probability distributions,
there are four functions, called d, p, q, r,
(e.g., dnorm, pnorm, qnorm, rnorm)
giving you the density (d), cumulative distribution function (p, since the result is a probability), its inverse (q, since the result is a quantile), and r to sample from the distribution.
For the Gamma distribution, the inverse of the cumulative distribution function is therefore qgamma.

Resources