Sign In
New User? Register
Statisticians_group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
You can set the sort order of messages? Just click on the link in the date column. Your preferences will be remembered, so you don't have to do it again when you return.

Messages

  Messages Help
Advanced
Difficulty in calculating MLE through NLM   Message List  
Reply | Forward Message #3586 of 4072 |

Dear Members,

 

Attached is the SAS XPORT file that I have imported into R using following code

library(foreign)

mydata<-read.xport("C:\\ctf.xpt")

print(mydata)

 

I am trying to maximize logL in order to find Maximum Likelihood Estimate (MLE) of 5 parameters (alpha1, beta1, alpha2, beta2, p) using NLM function in R as follows.

 

# Defining Log likelihood – In the function it is noted as logL

> library(stats)

> loglike1<- function(x)

+ {

+ alpha1<-x[1]

+ beta1<-x[2]

+ alpha2<-x[3]

+ beta2<-x[4]

+ p<-x[5]

+ n<- mydata[3]

+ e<-mydata[4]

+ f1<- ((1+beta1/e)^(-n))*((1+e/beta1)^(-alpha1))*gamma(alpha1+n)/(gamma(n+1)*gamma(alpha1))

+ f2<- ((1+beta2/e)^(-n))*((1+e/beta2)^(-alpha2))*gamma(alpha2+n)/(gamma(n+1)*gamma(alpha2))

+ logL=sum(log(p*f1+(1-p)*f2))

+ logL<- -logL

+ }

 

# Supplying starting parameter values

> theta<-c(.2041,.0582, 1.4150, 1.8380,0.0969)

 

# Calculating MLE using NLM function

> result<- nlm(loglike1, theta, hessian=TRUE, print.level=1)

 

Now the problem is, this is not working as there is no improvement in final parameter estimate over starting values and NLM just stops just after 1 iteration with gradient value of all the 5 parameters as zero. I have tried other set of starting values, but then also I am getting final parameter estimates similar to starting values and iteration stops just after one step. When I check for warnings, R displays following kind of warnings:

  • NA/Inf replaced by maximum positive value
  • value out of range in 'gammafn'

 

Please suggest what I should do. I am expecting the final MLE of alpha1, alpha2, beta1 and beta2 greater than 0 and P should lie between 0 to 1.

 
Thanks & Regards,
--------------

Madan Gopal Kundu
Biostatistician, Ranbaxy Labs. Ltd.
Gurgaon, Haryana
India
mobile: 91-9868788406
 


See the Web's breaking stories, chosen by people like you. Check out Yahoo! Buzz.

1 of 1 File(s)

Wed Jul 1, 2009 3:17 pm

madan4331
Offline Offline
Send Email Send Email

Forward
Message #3586 of 4072 |
Expand Messages Author Sort by Date

Dear Members,   Attached is the SAS XPORT file that I have imported into R using following code library(foreign) mydata<-read.xport("C:\\ctf.xpt") ...
Madan Kundu
madan4331
Offline Send Email
Jul 1, 2009
3:17 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help