Hi list,
I would like to maximize a likelihood function to obtain estimates. The problem 
is that i first have to have functions other functions that are in the 
likelihood that depend on the parameters. I was thinking of using optim but i 
do not know how to go about starting. A example of what i wish to do is given 
below. The parameters i wish to estimate are phi and gamma. 

How would i go about maximizing the likelihood function to obtain estimates?

Any help would be much appreciated

Nigel

# initial starting points
phi<-0.2
gamma<-0.1
n<-200
h<-c()
h[1]<-1
e<-c()
e[1]<-1
for (i in 2:n){
h[i]<-phi*e[i-1]+gamma*h[i-1]+3
e[i]<-rnorm(1,0,h[i])
}
likelihood<- sum(log(h)+e^2/2*h)

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to