maximum likelihood using nlm to estimate 4 variables

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

maximum likelihood using nlm to estimate 4 variables

Hi I need help

I am new to R and am having problems estimating parameters out of
3stage constrained function.

I have constructed a code as below and my data are two colomns of R_j
and R_m(sample given below). R_j and R_m represents the dependent and
independent variables respectively. The parameters al_j, au_j, b_j ,
and sigma_j need to be estimate and there are no initial estimates to


LF=if(R_j< 0)sum[ln(1/(2*pi*(sigma_j^2)))-(1/(2*(sigma_j^2))*(R_j+al_j-b_j*R_m))^2]
if(R_j> 0)sum[ln(1/(2*pi*(sigma_j^2)))-(1/(2*(sigma_j^2))*(R_j+au_j-b_j*R_m))^2]

est.nlm = nlm(llik,0) #not sure what to put for the 4 initial
estimates so I just put 0

Sample Data
R_j R_m
0.002 0.026567295
0.003 0.009798475
0.05 0.008497274
-0.01 0.012464578
-0.0009 0.002896023
0.09 0.000879473
0.01 0.003194435
0.0006 0.010281122

I will appreciate if you help me to modify my code to get my estimates
or give me any better method to use.

Thank you in advance

Student: Institute of Actuaries

[hidden email] mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.