[R] optim function with meta parameters

Alberto Casetta alberto.casetta at satt.biz
Fri Dec 17 16:07:02 CET 2010

I have a dataset with 4 columns. In the first and second column I have 
the same qualitative variable referred to different teams of people. 
There are 10 teams in total and they compete against each other to 
perform a certain task whose result is stored in the third column for 
the team recorded in the first column, and in the fourth column for the 
team in the second column.
For example, the first row of the dataset is:
team1   team2      2     3
that means that team1 performed the task competing against team 2 and 
got 2 points while team 2 got 3 points. Every working team competes 
against all other 9. It's exactly like a soccer league.

I have 190 observations in total and I need to estimate through a MLE 
the parameters of a poisson distribution that drive the results.

Assuming the independency of the results, I wrote the following code 
calculating the log-likelihood of the double poisson derived:

for(i in 1:10){


Now I should be able to do the task defining 
lambda=alfa(i)*beta(j)*gamma and mu=alfa(j)*beta(i) where i indicates 
team1 and j team2, while gamma is some sort of "home" advantage.
I have troubles to estimate alfa, beta and gamma.
Anyone can help?
Thank you so much!
Cordiali saluti / Best regards
Alberto Casetta

SATT S.r.l.
Via Magnadola, 56
I-31045 Motta di Livenza (TV)
Tel. +39 (0)422 768529
Fax +39 (0)422 766108

More information about the R-help mailing list