SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Max likelihood Estimation [ Reply ]
By: pari He on 2015-01-30 15:32
[forum:41856]

details 2.pdf (39) downloads
Dear Ott Toomet
I was able to find a helpful point . Please read the attachment(pdf file).
I would be happy whenever you answer my message.Thank you for your time.
Best Regards

RE: Max likelihood Estimation [ Reply ]
By: Ott Toomet on 2015-01-29 02:07
[forum:41848]
Dear pari,
sorry for the delay, had to work on other projects..

* sum_{k=0}^{n-1} is simply sum from k=0 to n-1 (latex notation).

* I don't know the distribution well enough to say what is wrong there. sum_{k=0}^{-1} does not seem to make much sense to me (but it depends on the notation). Analogously, you cannot compute factorial(-1). If you stumble on problems like this, my guess is that your interpretation of the density function is not quite right. Perhaps there are simpler distributions you can start with and add more complexity step-by-step after your previous estimation works?

Cheers,
Ott

RE: Max likelihood Estimation [ Reply ]
By: pari He on 2015-01-24 14:50
[forum:41829]
Dear Ott Toomet,
Thank you so much for your efforts.In total, I got the idea of the program . I don't understand what you mean about: sum_{k=0}^{n-1} ? Also, if I replace (n) with (n-1) in the 20th line of the program ((t - x)^n/factorial(n)*exp(-t + x)) , I will face with the error : In gamma(x + 1) : NaNs produced.

My main problem is n=0, especially when some expressions such as (t-x)^(n-1) is observed ( n starts from zero).
I would appreciate further helps.
Best Regards,

RE: Max likelihood Estimation [ Reply ]
By: Ott Toomet on 2015-01-23 20:51
[forum:41828]
Dear Pari He,
I think I implemented the estimator, at least the function below should give you the idea how to do it. A few remarks:
* look over your expression. Collect the term you sum and integrate over and simplify it.
* In particular, integrate only once, after you have added all the other terms. Integration is a slow operation.
* The stuff only converged for small alpha values and gave weird result but I did not investigate any further.
* you should also program the gradient. It seems quite easy here.

Cheers,
Ott


pariHe1 <- function(start=0.5) {
library(maxLik)
loglik <- function(alpha) {
## The first term
B <- function(x, k) {
((alpha + 1)*x)^k/factorial(k)*(t - x)^(n-1)/factorial(n-1)*exp(-alpha*x - t)
}
## The third term
C <- function(x, k) {
((alpha + 1)*x)^k/factorial(k)*(t - x)^(n)/factorial(n)*exp(-alpha*x - t)
}
A <- function(x) {
s <- rep(0, length(x))
# in case the following loop is not even entered...
## The first term: sum_{k=0}^{n-1}
for(k in seq(from=0, to=n-1)) {
s <- s + B(x, k)
}
## The second term
s <- s - (t - x)^n/factorial(n)*exp(-t + x)
## The second term
for(k in seq(from=0, to=n)) {
s <- s + C(x, k)
}
s
}
ll <- 0
for(n in seq(along=F)) {
lik <- integrate(A, 0, t)$value
ll <- ll + F[n]*log(lik)
}
ll
}
F<-c(0,1,3,5,7,8,11,10)
N <- length(F)
t <- 2
maxLik(loglik, start=start)
}

RE: Max likelihood Estimation [ Reply ]
By: pari He on 2015-01-22 17:47
[forum:41824]
Dear Ott Toomet
yes, all of them are the same. pr(n) is the short form of p(N(t)=n). This is a part of my probability mass function related to count distribution discussion(count model). It gives the number of events until time (t). t can be any positive real number, for easy calculation I considered t=2. If you have any other question which can help you for finding a solution, please feel free and ask me.
Best Regards,

RE: Max likelihood Estimation [ Reply ]
By: Ott Toomet on 2015-01-22 17:15
[forum:41823]
Dear Pari,
the document is readable now, thank you. Just a quick question: is "pr(n)" in several of your expressions the same as "p(N(t)=n)" in the first expression? It would also help if you explain a bit what are you doing (what is your model). I guess you do some sort of counts...

In general you are right: you just sum and integrate in your likelihood function, you have to do it (all too) often.


RE: Max likelihood Estimation [ Reply ]
By: pari He on 2015-01-22 08:59
[forum:41822]

Details.pdf (41) downloads
I have attached the file in pdf format.
Thank you for consideration.

RE: Max likelihood Estimation [ Reply ]
By: Arne Henningsen on 2015-01-21 20:59
[forum:41819]
Dear Pari He

I cannot read the file that you attached (I just can see strange symbols). If it is R code, please upload it as a plain-text file. If it is a document with equations, etc., please upload it in PDF format.

Best regards,
Arne

Max likelihood Estimation [ Reply ]
By: pari He on 2015-01-21 15:59
[forum:41817]

Details.docx (36) downloads
I have a new function. I can't use the current packages of R directly for getting the MLE of parameter. I am looking for a program to get the MLE in a short time. I will attach my function with the loglik function.

Thanks to:
Vienna University of Economics and Business Powered By FusionForge