Hi, I have a circular shaped set of point on the plane (X,Y) centered in zero. The distribution is more dense close to zero and less dense far from zero. I need to find the radius of a circle centered in zero that contains 65% of the points in the sample. Is there any R directive that can do this? I wanna start with 2D set of points, but the real case scenario is with a 5D set of points. Thanks, Francesco
On Jan 21, 2011, at 11:33 AM, Francesco Petrogalli wrote:> Hi, > I have a circular shaped set of point on the plane (X,Y) centered in > zero. The distribution is more dense close to zero and less dense far > from zero. > > I need to find the radius of a circle centered in zero that contains > 65% of the points in the sample. Is there any R directive that can do > this? > > I wanna start with 2D set of points, but the real case scenario is > with a 5D set of points.Something along the lines of dxy= with(dfm, sqrt(x^2 +y^2)) quantile(dxy, probs=0.65) The generalization to 5 dimensions appears trivial. Even the generalization to finding the radius around an arbitrary point seems trivial assuming an L2 norm. -- David Winsemius, MD West Hartford, CT
Hi, I am trying to determine how many points fall ouside the confidence interval range. This is the code I have so far but it does not work. Any help would be appreciated. Count <- vector () for (i in 1: nrow (dataname)){ if (dataname[i] <l.ci.post[1]// dataname[i] >u.ci.post[i]){ count[i] -> 1 }else {count[i] -> 0} } symbol // = or - not sure if this is the right symbol though -- View this message in context: http://r.789695.n4.nabble.com/Confidence-interval-tp3304258p3304258.html Sent from the R help mailing list archive at Nabble.com.
Hi, The logical operators are actually vectorized, so I do not think you need a loop. Does this do what you want? ## Some data set.seed(10) dat <- matrix(rnorm(500, sd = 3), nrow = 80) ## Hypothetical confidence interval ci <- c(-5, 5) ## Find the number of points outside interval sum(dat < ci[1] | dat > ci[2], na.rm = TRUE) Cheers, Josh On Sun, Feb 13, 2011 at 4:26 PM, Syd88 <jhea2850 at uni.sydney.edu.au> wrote:> > Hi, > I am trying to determine how many points fall ouside the confidence interval > range. > > This is the code I have so far but it does not work. Any help would be > appreciated. > > Count <- vector () > for (i in 1: nrow (dataname)){ > if (dataname[i] <l.ci.post[1]// > dataname[i] >u.ci.post[i]){ > count[i] -> 1 > }else > {count[i] -> 0} > } > > > > symbol > // = or - not sure if this is the right symbol though > -- > View this message in context: http://r.789695.n4.nabble.com/Confidence-interval-tp3304258p3304258.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org 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. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
Seemingly Similar Threads
- How to calculate confidence interval of C statistic by rcorr.cens
- validate.lrm - confidence interval for boostrap-corrected AUC ?
- Computing Confidence Intervals for AUC in ROCR Package
- findInterval and data resolution
- Confidence interval for difference in Harrell's c statistics (or equivalently Somers' D statistics)