Skip to content
Back to formatted view

Raw Message

Message-ID: <99BABC94-4772-415D-9D3C-18D1965B5777@icloud.com>
Date: 2016-03-01T20:09:09Z
From: Alaa Sindi
Subject: help in maximum likelihood

Hi all,

what is wrong with this code? I am trying to estimate the model parameters by maximizing the likelihood function and I am getting this warning 


Warning message:
In nlm(fn, p = c(-50, 20), hessian = TRUE) :
  NA/Inf replaced by maximum positive value




x <- c(1.6907, 1.7242, 1.7552, 1.7842, 1.8113, 1.8369, 1.8610, 1.8839)
y <- c( 6, 13, 18, 28, 52, 53, 61, 60)
n <- c(59, 60, 62, 56, 63, 59, 62, 60)
fn <- function(p)
    sum( - (y*(p[1]+p[2]*x) - n*log(1+exp(p[1]+p[2]*x))
            + log(choose(n, y)) ))
out <- nlm(fn, p = c(-50,20), hessian = TRUE)


Thanks