Forum: help
Monitor Forum | Start New ThreadRE: Use of maxLik [ Reply ] By: Arne Henningsen on 2018-04-04 06:56 | [forum:45807] |
Please provide code that we can (easily) run in (e.g., copy & paste to) R in order to reproduce your example. |
RE: Use of maxLik [ Reply ] By: Emma Okereke on 2018-03-31 23:50 | [forum:45804] |
Thanks for your assistance so far. Below are the log likelihood functions: (1) logetld<-function(p) n*log(p[1])+2*n*log(p[2])-n*log(p[2]+1)+sum(log(eted+1))-p[2]*sum(eted)+sum(log(1-p[3]+2*p[3]*((p[2]+1+p[2]*eted)/(p[2]+1))*exp(-p[2]*eted)))+(p[1]-1)*sum(log(1-((p[2]+1+p[2]*eted)/(p[2]+1))*exp(-p[2]*eted)))+(p[1]-1)*sum(log(1+p[3]*((p[2]+1+p[2]*eted)/(p[2]+1))*exp(-p[2]*eted))); (2) logttldd<-function(p) 2*n*log(p[1])-n*log(p[1]+p[2])-p[1]*sum(eted)+sum(log(1+p[2]*eted))+sum(log(1-p[3]+2*p[3]*((p[1]+p[2]+1+p[1]*p[2]*eted)/(p[2]+p[1]))*exp(-p[1]*eted))); (3) logeld<-function(p) n*log(p[1])+2*n*log(p[2])-n*log(p[2]+1)+sum(log(eted+1))-p[2]*sum(eted)+(p[1]-1)*sum(log(1-((p[2]+1+p[2]*eted)/(p[2]+1))*exp(-p[2]*eted))). The data (eted) are as follows: 0.08 2.09 3.48 4.87 6.94 8.66 13.11 23.63 0.20 2.23 3.52 4.98 6.97 9.02 13.29 0.40 2.26 3.57 5.06 7.09 9.22 13.80 25.74 0.50 2.46 3.64 5.09 7.26 9.47 14.24 25.82 0.51 2.54 3.70 5.17 7.28 9.74 14.76 26.31 0.81 2.62 3.82 5.32 7.32 10.06 14.77 32.15 2.64 3.88 5.32 7.39 10.34 14.83 34.26 0.90 2.69 4.18 5.34 7.59 10.66 15.96 36.66 1.05 2.69 4.23 5.41 7.62 10.75 16.62 43.01 1.19 2.75 4.26 5.41 7.63 17.12 46.12 1.26 2.83 4.33 7.66 11.25 17.14 79.05 1.35 2.87 5.62 7.87 11.64 17.36 1.40 3.02 4.34 5.71 7.93 11.79 18.10 1.46 4.40 5.85 8.26 11.98 19.13 1.76 3.25 4.50 6.25 8.37 12.02 2.02 3.31 4.51 6.54 8.53 12.03 20.28 2.02 3.36 6.76 12.07 21.73 2.07 3.36 6.93 8.65 12.63 22.69 5.49 I will like to obtain maximum likelihood estimates , AIC, BIC, AICC and KS using the log likelihood functions and the data. Information on how to perform this task will be highly appreciated. I look forward to hearing from you. Once again, thank you. |
RE: Use of maxLik [ Reply ] By: Arne Henningsen on 2018-03-30 08:12 | [forum:45802] |
It seems that your log likelihood returns "NA" when it is called with your starting values: hence, either there is a mistake in your log-like function or your starting values are unsuitable. You can get better help if you provide code that allows us to easily reproduce your example. |
Use of maxLik [ Reply ] By: Emma Okereke on 2018-02-28 10:38 | [forum:45717] R request.docx (12) downloads |
Good day all. I actually want to estimate the parameters of a probability distribution using the maxLik in R. The log likelihood function is function(p) n*log(p[1])+n*(p[1])*log(0.0251)-(p[1]+1)*sum(log(FATIGUE))+n*log(p[3])+sum(log(1-p[2]+2*p[2]*(0.0251/FATIGUE)^p[1]))+(p[3]-1)*sum(log(1-(0.0251/FATIGUE)^p[1]))+(p[3]-1)*sum(log(1+p[2]*(0.0251/FATIGUE)^p[1])) while the data (FATIGUE) are as follows 0.0251,0.0886,0.0891,0.2501,0.3113,0.3451,0.4763,0.5650,0.5671,0.6566,0.6748,0.6751,0.6753,0.769 6,0.8375,0.8391,0.8425,0.8645,0.8851,0.9113,0.9120,0.9836,1.0483,1.0596,1.0773,1.1733,1.2570,1.276 6,1.2985,1.3211,1.3503,1.3551,1.4595,1.4880,1.5728,1.5733,1.7083,1.7263,1.7460,1.7630,1.7746,1.827 5,1.8375,1.8503,1.8808,1.8878,1.8881,1.9316,1.9558,2.0048,2.0408,2.0903,2.1093,2.1330,2.2100,2.246 0,2.2878,2.3203,2.3470,2.3513,2.4951,2.5260,2.9911,3.0256,3.2678,3.4045,3.4846,3.7433,3.7455,3.914 3,4.8073,5.4005,5.4435,5.5295,6.5541,9.0960. Each time I specify the initial values and want to obtain the estimates, there will be message like "NANS" produced or 0 iteration. Please, I need your assistance. |