[R] (no subject)

Daniel Halligan daniel.halligan at ed.ac.uk
Fri Oct 27 15:02:03 CEST 2006


Hi,

I have generated a profile likelihood for a parameter (x) and am  
trying to get 95% confidence limits by calculating the two points  
where the log likelihood (LogL) is 2 units less than the maximum  
LogL.  I would like to do this by linear interpolation and so I have  
been trying to use the function approxfun which allows me to get a  
function to calculate LogL for any value of x within the range of x  
values.

My data frame can be entered as follows:
dat = data.frame(x = c(0.00000, 0.00010, 0.00100, 0.01000, 0.02404,  
0.02404, 0.07603, 0.07603, 0.10000, 0.12021, 0.12021, 0.15146,  
0.15146, 0.19083, 0.19083, 0.24007, 0.24007, 0.24043, 0.24043,  
0.24043, 0.24043, 0.24049, 0.24049, 0.30292, 0.30292, 0.38166,  
0.38166, 0.48086, 0.48086, 0.76031, 0.76031, 1.00000, 2.00000,  
2.40430, 2.40430), LogL =  c(-2902.814, -2897.687, -2895.332,  
-2892.734, -2891.850, -2891.850, -2890.998, -2890.998, -2890.859,  
-2890.783, -2890.783, -2890.708, -2890.708, -2890.659, -2890.659,  
-2890.641, -2890.641, -2890.641, -2890.641, -2890.641, -2890.641,  
-2890.641, -2890.641, -2890.661, -2890.661, -2890.728, -2890.728,  
-2890.855, -2890.855, -2891.323, -2891.323, -2891.775, -2893.487,  
-2894.038, -2894.038))

I need to approximately calculate the two points when max(dat$LogL) -  
dat$LogL = 2.  Does anyone know how this can be done, using approxfun  
or any other method?  Any help greatly appreciated.

Dan Halligan
------------------------------------------------
Daniel Halligan
Institute of Evolutionary Biology
University of Edinburgh
Ashworth Labs., West Mains Rd.,
Edinburgh EH9 3JT, UK



More information about the R-help mailing list