I am hoping someone may be able to help me out here. I need to build up a likelihood function algorithmically based on the data. The likelihood function is almost impossible to generate analytically due to a large number of summations. I just can't figure out how to get the variables into the function as I go down the data. The general form of the function is: Lik() = Sum_i Sum_j Sum_k x_i * x_j * x_k * n()_ij * n()_jk where the numbers i,j,k can go from 1 to 5 and n() are the normal densities. In going through the data, I can determined the vectors x, so the general form is x = c(g1,g2,g3,g4,g4) which is the vector of the coefficients of the g variables and describes a probability. I'm trying to do a maximum likelihood estimation to get the g variables given some input data. I'm at a dead end with trying to form the likelihood function. Any insights from the folks out there? res -- View this message in context: http://www.nabble.com/help-in-buliding-a-likelihood-function...-tp24613820p24613820.html Sent from the R help mailing list archive at Nabble.com.