1

i want to estimate the parameters of beta-normal distribution.I've used the maxLik package

library(VGAM)
library(maxLik)
alfa=2;beta=3;mu=0;sigma=1
n=100
x=rbetanorm(n,alfa,beta,mu,sigma)
logLikFun=function(w){
  alfa=w[1]
  beta=w[2]
  mu=w[3]
  sigma=w[4]
  ll={-n*log(beta(alfa,beta))+(alfa-1)*sum(log(pnorm((x-mu)/sigma,mean=0,sd=1)))+(beta-1)*sum(log(1-pnorm((x-mu)/sigma,mean=0,sd=1)))-n*log(sigma)+sum(log(dnorm((x-mu)/sigma,mean=0,sd=1)))}
  ll
}
mle=maxLik(logLikFun,start=c(alfa=3,beta=2,mu=1,sigma=2))
summary(mle)

but it gives error

----------------------------------
Maximum Likelihood estimation
Newton-Raphson maximisation, 4 iterations
Return code 2: successive function values within tolerance limit
Log-Likelihood: -86.16515 
4  free parameters
Estimates:
      Estimate Std. error t value Pr(> t)
alfa     3.000        Inf       0       1
beta     2.941        Inf       0       1
mu       1.000        Inf       0       1
sigma    2.000        Inf       0       1
--------------------------------------------

the problem is the infinite value for the errors which is not acceptable. I would be pleased if someone could solve this problem.

mt1022
  • 16,834
  • 5
  • 48
  • 71
saly
  • 11
  • 3
  • 1
    Are you sure you have the likelihood correct? Where's the reference to the definition you are using. I'm guessing there are some constraints on your parameter definitions that you are not accounting for. – MrFlick Oct 09 '17 at 23:01
  • MrFlick, the density function of beta-normal distribution is in the following: https://www.researchgate.net/publication/238865380_Beta-normal_distribution_and_its_application. step by step I've done it in the R and it is running except the last line.(I mean the mle=maxLik.....) – saly Oct 10 '17 at 01:42

1 Answers1

0

The results are extremely dependent to the initial values. Also, you can set some initial values as fixed values.

For more information regarding the theoretical issues behind the code refer to this link.

library(VGAM)
library(maxLik)
alfa=1;beta=1;mu=0;sigma=1
n=100
x<-rbetanorm(n,alfa,beta,mu,sigma)
logLikFun<-function(w){
        alfa<-w[1]
        beta<-w[2]
        mu<-w[3]
        sigma<-w[4]
        ll<-{-n*log(beta(alfa,beta))+(alfa-1)*sum(log(pnorm((x-mu)/sigma,mean=0,sd=1)))+(beta-1)*sum(log(1-pnorm((x-mu)/sigma,mean=0,sd=1)))-n*log(sigma)+sum(log(dnorm((x-mu)/sigma,mean=0,sd=1)))}
        ll
}
mle<-maxLik(logLikFun,grad=NULL,hess=NULL,start=c(alfa=1,beta=1,mu=mean(x),sigma=1),"NR")
summary(mle)


OUTPUT:
--------------------------------------------
Maximum Likelihood estimation
Newton-Raphson maximisation, 10 iterations
Return code 2: successive function values within tolerance limit
Log-Likelihood: -139.6822 
3  free parameters
Estimates:
        Estimate Std. error t value  Pr(> t)    
alfa    0.4026     0.1190   3.384 0.000714 ***
beta    4.3981     2.9560   1.488 0.136794    
mu      2.0340     0.6135   3.315 0.000915 ***
sigma   1.0000     0.0000      NA       NA    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
--------------------------------------------
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135