Displaying 2 results from an estimated 2 matches for "oukal".
Did you mean:
foukal
2010 Apr 21
2
Maximum Likelihood Estimation in R
...o multiplied the log-likelihood function by -1, since I know that
R by default minimizes the objective function.
I would be very happy if you can come up with some Ideas on what is going
wrong in the code below.
Thank you for your time!
Henrik
> data<-read.table(file="c:/users/oukal.csv",header=TRUE)
> y<-data$V1
> loglik<-function(estimate,y)
+ {
+ lap<-estimate[1]
+ stdev<-estimate[2]
+ rev<-estimate[3]
+ n<-length(y)
+
+ 0.5*n*log(2*pi)+ 0.5*n*log(stdev) +
+ (1/(2*stdev*stdev))*sum(y-(rev/12)-lag(y)*exp(-lap/12))
+ }
>
> optim(c(4,4,4),l...
2010 Apr 21
0
(no subject)
...ve also multiplied the log-likelihood function by -1, since I know that R by default minimizes the objective function.
I would be very happy if you can come up with some Ideas on what is going wrong in the code below.
Thank you for your time!
Henrik
> data<-read.table(file="c:/users/oukal.csv",header=TRUE)
> y<-data$V1
> loglik<-function(estimate,y)
+ {
+ lap<-estimate[1]
+ stdev<-estimate[2]
+ rev<-estimate[3]
+ n<-length(y)
+
+ 0.5*n*log(2*pi)+ 0.5*n*log(stdev) +
+ (1/(2*stdev*stdev))*sum(y-(rev/12)-lag(y)*exp(-lap/12))
+ }
>
> optim(c(4,4,4),log...