search for: logliklihood

Displaying 4 results from an estimated 4 matches for "logliklihood".

Did you mean: loglikelihood
2008 Jul 25
3
Maximization under constraits
I''m looking for a R function which can maximise this logliklihood function, under the constraits a>0 e b>0 f<-function(param){ a<-param[1] b <-param[2] log(prod)-(a*s2)-(b*s)-n*log(1-((0.5*b/sqrt(a))*(exp((b^2)/(4*a)))*((sqrt(pi ))*(1-pnorm(-b/(2*sqrt(a)), mean=0, sd=1)))))} I''ve tried maxlik constrOptim e donlp2 but without...
2012 Nov 30
2
NA return to NLM routine
...k <- c(2, 1, 1, 5, 5) f <- c(1, 1, 1, 3, 2) loglikelihood <- function(theta,k,f){ if( theta<1 && theta>0 ) return(-1*sum(log(choose(k,f))+f*log(theta)+(k-f)*log(1-theta))) return(NA) } nlm(loglikelihood ,0.5, k, f ) Running this code results in: Error in nlm(logliklihood, 0.5, k, f) : invalid function value in 'nlm' optimizer However if the line return(NA) is changed to return(-NA) or even return(1*NA) or return(1/0), the code works. Is this expected behavior? The nlm help file says not NA or not NaN are acceptable values but I don't understand what...
2017 Aug 06
1
Help with optim function in R, please?
...ize my function. I built my code but I do not know how to make the optim function run over a different value of the parameters.? That is, For E-step I need to get the value of mixture weights based on the current (initial) values of the parameter of the density. Then, multiple the weight by the logliklihood function and maximize it (M-step) Then, I would like to take the new values of the parameter (from M-step) and plug it in the weight, to get a new value of the weight. Then, iterate till converges. I tried the following code, but it does not work. library(copula) library(VineCopula) ## to gene...
2012 Mar 05
1
Fitting & evaluating mixture of two Weibull distributions
Hello, I would like to fit a mixture of two Weibull distributions to my data, estimate the model parameters, and compare the fit of the model to that of a single Weibull distribution. I have used the mix() function in the 'mixdist' package to fit the mixed distribution, and have got the parameter estimates, however, I have not been able to get the log-likelihood for the fit of this model