[R] (no subject)

From: Daniel Halligan <daniel.halligan_at_ed.ac.uk>
Date: Fri 27 Oct 2006 - 13:02:03 GMT


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

R-help@stat.math.ethz.ch 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. Received on Sat Oct 28 00:37:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 27 Oct 2006 - 16:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.