[R] voronoi/Delaunay/Dirichlet tessellation on sphere in R or S?
There's Renka's STRIPACK, and TRIPACK, respectively, ACM TOMS Algorithms 772 and 751, and there's the R package "deldir" which does the Delaunay for a plane, but does anyone have or know of the tessellation in R for a sphere? Also, is there a standard indexing scheme for Delaunay facets, and perhaps of edges in such facets? I'd expect that to be a publication reference, or even textbook. TIA, - Jan [[alternative HTML version deleted]] __ R-help@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.
Re: [R] voronoi/Delaunay/Dirichlet tessellation on sphere in R or S?
Thanks much, François. The price of Okabe et al is quite dear, so I think I'll stick with Aurenhammer's survey, http://doi.acm.org/10.1145/116873.116880 and Aurenhammer and Klein, http://www.pi6.fernuni-hagen.de/publ/tr198.pdf -Original Message- From: Sandrine-et-Francois [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 28, 2007 4:08 PM To: Galkowski, Jan; r-help@r-project.org Subject: Re: [R] voronoi/Delaunay/Dirichlet tessellation on sphere in R or S? Hi Jan, In case you don't know it already, the reference book for Voronoi diagrams and co. is : Spatial Tessellations: Concepts and Applications of Voronoi Diagrams by Okabe et al. (Ed. Wiley). It's a bit old now ... but it's 'a' good reference. HTH, Best regards, François - Original Message - From: "Galkowski, Jan" <[EMAIL PROTECTED]> To: Sent: Tuesday, November 27, 2007 5:51 PM Subject: [R] voronoi/Delaunay/Dirichlet tessellation on sphere in R or S? > There's Renka's STRIPACK, and TRIPACK, respectively, ACM TOMS Algorithms > 772 and 751, and there's the R package "deldir" which does the Delaunay > for a plane, but does anyone have or know of the tessellation in R for a > sphere? > > Also, is there a standard indexing scheme for Delaunay facets, and > perhaps of edges in such facets? I'd expect that to be a publication > reference, or even textbook. > > TIA, > > - Jan > > > > [[alternative HTML version deleted]] > > __ > R-help@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. > __ R-help@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.
[R] the woes of NA
Joyful. I'm adapting a FORTRAN 77 package for use with R. Pretty straightforward. Except for a glitch it took me some time to figure out. This existing package has subroutines which have parameters called "NA". So, I called subroutines like bnodes <- function(n, lst, lptr, lend, nodes, nb, na, nt) { ensure.all.numeric(list(n, lst, lptr, lend, nodes, nb, n.a, nt), "all arguments to -bnodes- must be numeric") out <- .Fortran("bnodes", N=as.integer(n), LIST=as.integer(lst), LPTR=as.integer(lptr), LEND=as.integer(lend), NODES=as.integer(nodes), NB=as.integer(nb), NA=as.integer(na), NT=as.integer(nt)) return(out[5:8]) } I had called routines successfully before, so I couldn't figure out what was wrong. By elimination, I discovered that the parameter pass NA=as.integer(na) was to blame. So, thinking the right-hand-side (R's world) was the problem, even if "na" wasn't recognized as "not available", I changed to: bnodes <- function(n, lst, lptr, lend, nodes, nb, n.a, nt) { ensure.all.numeric(list(n, lst, lptr, lend, nodes, nb, n.a, nt), "all arguments to -bnodes- must be numeric") out <- .Fortran("bnodes", N=as.integer(n), LIST=as.integer(lst), LPTR=as.integer(lptr), LEND=as.integer(lend), NODES=as.integer(nodes), NB=as.integer(nb), NA=as.integer(n.a), NT=as.integer(nt)) return(out[5:8]) } No win. I would only be happy if I used bnodes <- function(n, lst, lptr, lend, nodes, nb, n.a, nt) { ensure.all.numeric(list(n, lst, lptr, lend, nodes, nb, n.a, nt), "all arguments to -bnodes- must be numeric") out <- .Fortran("bnodes", N=as.integer(n), LIST=as.integer(lst), LPTR=as.integer(lptr), LEND=as.integer(lend), NODES=as.integer(nodes), NB=as.integer(nb), NAA=as.integer(n.a), NT=as.integer(nt)) return(out[5:8]) } and had to actually change the FORTRAN code to comply. Sounds to me like there's a little room for improvement here. Should be documented anyway. __ R-help@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.
[R] smoothest way to upgrade R, say from 2.6.1 to 2.6.2?
Like many software assemblies, R is updated frequently. Also, it creates its own release-numbered directory when it is installed. Packages get dumped into the subdirectory "library". I have a personal habit of storing documents related to R packages in the "doc" subdirectory. Here are my questions. (1) How do people manage an upgrade, from 2.6.1, say, to 2.6.2? 2.6.2 will create its own subdirectory, obliging a copy of library contents to the new spot. The documents are easier. (2) The problem with simply copying library contents is a fear of upward incompatibilities. Am I worrying for naught here? Are packages upward compatible but possibly not downwardly so? (3) What about changing shortcuts, places for .Rprofile and the like? Do people have scripts that do all these things at once? It would be nice to have a single control file where R binaries and libraries and the like could be specified. That way, all that would need to be done is edit one file with an uptick on a point release number, say, and things would be fine. I suggest this because R is so rich and deep that there may well be such a thing I just don't know about. Or there may be a way of arranging things so they are done this way. Ideas? -- Jan [[alternative HTML version deleted]] __ R-help@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.
Re: [R] smoothest way to upgrade R, say from 2.6.1 to 2.6.2?
Thanks to Stefan Grosse, Gabor Grothendieck, and Professor Ripley for all this guidance. I have collected the details, concatenating them below, for future reference. Sorry if attributions got muddled. It is WinXP Pro in the primary, and there's no need to keep around older versions. But there are (Debian) Linux users here interested in both the same question, and any caches of R-related shell goodies that might be out there, comparable to "batchfiles", both for upgrades and other things, like maybe spawning multiple R processes and the like, or running headless Rs on several servers at once. I apologize for leaving that out, but I thought putting out a wild guess on this might draw comment and help. It did. Thanks much, again. -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2008 2:12 PM To: Stefan Grosse Cc: r-help@r-project.org; Galkowski, Jan Subject: Re: [R] smoothest way to upgrade R, say from 2.6.1 to 2.6.2? If this _is_ Windows, the question is discussed in detail in the rw-FAQ. That document also discusses how to install packages into a site or personal library which can make upgrading easier. Another consideration not told to us was whether one wants to keep around a working copy of the older version. My dept does so (so students can use a consistent version when preparing their theses, for example), and that affects the choice of strategy. On Thu, 13 Mar 2008, Stefan Grosse wrote: > On Thursday 13 March 2008 06:05:15 pm Galkowski, Jan wrote: > GJ> (1) How do people manage an upgrade, from 2.6.1, say, to 2.6.2? > GJ> 2.6.2 will create its own subdirectory, obliging a copy of library > GJ> contents to the new spot. The documents are easier. > > You forgot to enlighten us about your system. From what you are > telling I would guess its Windows (XP?). On my windows machine I > install R in the very same directory of the old R. So you could create > programs/R and there install your R but of course you must then > alternate the suggested directory during the installation. > > GJ> > GJ> (2) The problem with simply copying library contents is a fear of > GJ> upward incompatibilities. Am I worrying for naught here? Are > GJ> packages upward compatible but possibly not downwardly so? > > There is no problem within minor releases like 2.6.1 -> 2.6.2 but on > greater "jumps" update.packages offers the option checkbuilt which if > set TRUE updates the packages to their next built. So if 2.7.0 is > released and you install that are over your old you should enable this option. > > > GJ> (3) What about changing shortcuts, places for .Rprofile and the like? > GJ> Do people have scripts that do all these things at once? > > See above > > GJ> > GJ> It would be nice to have a single control file where R binaries > GJ> and libraries and the like could be specified. That way, all that > GJ> would need to be done is edit one file with an uptick on a point > GJ> release number, say, and things would be fine. > [snip] > GJ> Where does this "update.packages" with the "checkbuilt" live? > > just type update.packages() > in case of a major version change update.packages(checkbuilt=T) > > GJ> Is all this described on the Wiki some place? Or in the docs? > > In the docs > run > ?update.packages > > or have a look at the admin guide > http://cran.r-project.org/doc/manuals/R-admin.html > > [snip] > I think Stefan has answered this so I will just > add this about batchfiles. In the batchfiles distrirbution: > > http://batchfiles.googlecode.com > > is a file Rgui.bat. If you put that anywhere in your path and make > your shortcut to that instead of to R itself then it will find the most > recent version of R from the registry and start that so you don't have > to update shortcuts each time you change R versions. There are > also Rcmd.bat, sweave.bat and similar versions for the corresponding > tasks. Using those you never have to set your path to R when > installing or upgrading R on Windows. > > The most recent version of batchfiles is for Vista and the next to > most recent is for XP as per home page. > > If you do want to move or copy your packages from one library to > another movedir.bat and copydir.bat will do that. You can then use > checkbuilt if its a major version change. There are also some other > methods described in the Links on the home page. > > __ R-help@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.
[R] convex optimization package for R, specifically semidefinite programming
Recently, a package for convex optimization was announced for Python, based upon the LP solver GLPK, the SDP solver in DSDP5, and the LP and QP solvers in MOSEK. I'm aware GLPK is available for R, but wondered if anyone had good packages for convex optimization along these lines for R. TIA. __ R-help@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.
[R] predict "interval" for lmRob?
lm's "predict" function offers an "interval" parameter to choose between 'confidence' and 'prediction' bands. In the package "robust" and for "lmRob", there is also a "predict" but it lacks such a parameter, and the documented "type" parameter has only "response" offerred. Is there some way of obtaining prediction bands from lmRob? Is there an alternative robust (linear) regression package that offers such a capability? Thanks for any and all help. - Jan Galkowski, Akamai Technologies, Cambridge, MA. __ R-help@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.
Re: [R] predict "interval" for lmRob?
Hi Greg, Thanks for your guidance. In this case, the evidence is that the primary subpopulation of the data, accounting for observes the standard statistical model in the sense that Rice uses the term. It may by all accounts be normally distributed, and a Q-Q shows a large portion of the primary subpopulation behaves that way, out to 2 theoretical quantiles. But, for the measurement ranges of interest, the complement of the "normal subpopulation", accounting for some 20% of the total two million data points, behaves in other ways, which are, as a matter of fact, poorly understood. That's not likely to change soon. The choice of a robust regression framework and of "robust" (and possibly "quantreg" as Prof Koenker suggested) was simply to automatically fit a line to the primary subpopulation, without having to make arbitrary choices as what to keep or what to discard. Also, use of any preexisting package was simply pursued as a timesaver, worksaver, and to have some conceptual framework within to proceed other than just throwing least squares at arbitrarily chosen subsets. It sounds to me like I might use the robust regression to decide what to discard and then apply standard linear "lm" to the remainder, minding the diagnostics. Should they prove favorable, I'll proceed with the result of "lm". Thanks for pointing out the limitations of "robust" and its kin for me. BTW, if "robust" does not adopt a normal model for the y variable, what's the proper interpretation of the standard errors for slope and intercept it yields? A reference? - Jan -Original Message- From: Greg Snow [mailto:greg.s...@imail.org] Sent: Wednesday, April 08, 2009 1:20 PM To: Galkowski, Jan; r-help@r-project.org Subject: RE: predict "interval" for lmRob? Your problem is related to the theory underlying linear models (and is an example as to why it is important to understand the theory, not just know how to plug numbers into a computer). The lm function is based on theory that assumes the y variable in normally distributed with the mean of that normal based on the model and the x values. This allows the predict function for lm to create prediction intervals based on the normal distribution, the predicted mean of that distribution, the estimated standard deviation, and the uncertainty in the predicted mean. Note that if your y variable is not normally distributed, but the sample size is large enough for the Central Limit Theorem to hold, then the confidence intervals will be approximately correct, but the prediction intervals will probably not be. When you switch to a robust regression approach, the assumption is that the y variable is not normal, so a prediction interval based on the normal distribution does not make sense. To get an appropriate prediction interval you need some information on what the distribution of the y values is (conditional on the model), but most robust techniques are not based on a specific distribution, just some properties of the distribution. Without some information (or at least an assumption) on that distribution, the predict method cannot create prediction intervals. I know that this does not answer your question, but hopefully helps you to understand what is happening. Think about what your actual scientific question is, it may be that you can answer the question without prediction intervals. If you feel that you really need the prediction intervals, then you will need to do some additional background research into what distribution you think the data comes from, then you can proceed from there. Some options include fitting a model based on that distribution, simulating data from the distribution given the model estimates and the uncertainty in those estimates, quantile regression, mixture of regressions, and others. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Galkowski, Jan > Sent: Wednesday, April 08, 2009 9:32 AM > To: r-help@r-project.org > Subject: [R] predict "interval" for lmRob? > > lm's "predict" function offers an "interval" parameter to choose > between 'confidence' and 'prediction' bands. In the package "robust" > and for "lmRob", there is also a "predict" but it lacks such a > parameter, and the documented "type" parameter has only "response" > offerred. Is there some way of obtaining prediction bands from lmRob? > Is there an alternative robust (linear) regression package that offers > such a capability? > > Thanks for any and all help. > > -
Re: [R] predict "interval" for lmRob?
[snip] >Discarding actual data points always makes me nervous. Sometimes the points >we want to discard are actually the most interesting. No doubt this is true, and there's a lot of information in those outliers, a lot of structure. For instance, in this case, one part of the outlier population is actually identifiable as a valid part of the primary dataset having the abscissa shifted by a known constant. The mechanism for that is known, so it could be defended that this portion of the outliers could be added back into the main population by removing the shift. Still, not much else is known about its surround, so I/we wonder what else we'd be picking up if that were done. But for the primary application, which is a calibration, I think going after the main population is what's wanted right now. Thanks again. - Jan [snip] __ R-help@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.
[R] documenting quirky behavior of as.POSIXct, as.POSIX.lt regarding AM/PM, possibly other cases
I wanted to put this on the R Wiki, but found the suitable pages were read-only. I wanted to get it out in public to save people work. I was converting dates like "2009/03/26 01:00:00 AM" using as.POSIXct. I found that using a format of "%Y/%m/%d %I:%M:%S %p" did not work correctly to distinguish AM from PM. Both were converted into the same timestamp. Indeed, what I found worked was affixing a space after the string timestamp to produce "2009/03/26 01:00:00 AM " or "2009/03/26 01:00:00 PM ". That works. Didn't see this documented in the associated pages anywhere. I wonder if the help system might benefit from user comments like for instance PHP has? __ R-help@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.