| 1 |
\name{tkdensity} |
| 2 |
\alias{tkdensity} |
| 3 |
\title{GUI Density Estimation using Tcl/Tk} |
| 4 |
\description{ |
| 5 |
This is graphical user interface (GUI) to \code{\link{density}}, |
| 6 |
allowing for dynamic bandwidth choice and a simple kind of zooming, |
| 7 |
relying on \code{library(tcltk)}. |
| 8 |
} |
| 9 |
\usage{ |
| 10 |
tkdensity(y, n = 1024, log.bw = TRUE, showvalue = TRUE, |
| 11 |
xlim = NULL, do.rug = size < 1000, kernels = NULL, |
| 12 |
from.f = if (log.bw) -2 else 1/1000, |
| 13 |
to.f = if (log.bw) +2.2 else 2, |
| 14 |
col = 2) |
| 15 |
} |
| 16 |
\arguments{ |
| 17 |
\item{y}{numeric; the data the density of which we want.} |
| 18 |
\item{n}{integer; the number of abscissa values for |
| 19 |
\code{\link{density}} evaluation (and plotting).} |
| 20 |
\item{log.bw}{logical; if true (default), the gui scrollbar is on a |
| 21 |
\emph{log} bandwidth scale, otherwise, simple interval.} |
| 22 |
\item{showvalue}{logical; if true, the value of the current (log) |
| 23 |
bandwidth is shown on top of the scrollbar.} |
| 24 |
\item{xlim}{initial \code{xlim} for plotting, see \code{\link{plot.default}}.} |
| 25 |
\item{do.rug}{logical indicating if \code{\link{rug}(y)} should be |
| 26 |
added to each plot. This is too slow for really large sample sizes.} |
| 27 |
\item{kernels}{character vector of kernel names as allowable for the |
| 28 |
\code{kernels} argument of the standard \code{\link{density}} function.} |
| 29 |
\item{from.f, to.f}{numeric giving the left and right limit of the |
| 30 |
bandwidth scrollbar.} |
| 31 |
\item{col}{color to be used for the density curve.} |
| 32 |
} |
| 33 |
\details{ |
| 34 |
\code{library(tcltk)} must be working, i.e., Tcl/Tk must have been |
| 35 |
installed on your platform, and must have been visible during \R's |
| 36 |
configuration and/or installation. |
| 37 |
|
| 38 |
You can not only choose the bandwidth (the most important parameter), |
| 39 |
but also the kernel, and you can zoom in and out (in x-range only). |
| 40 |
} |
| 41 |
\value{ |
| 42 |
none.\cr |
| 43 |
(How could this be done? \code{tcltk} widgets run as separate processes!) |
| 44 |
} |
| 45 |
\author{Martin Maechler, building on \code{demo(tkdensity)}.} |
| 46 |
|
| 47 |
\examples{ |
| 48 |
if (dev.interactive(TRUE)) ## does really not make sense otherwise |
| 49 |
if(try(require("tcltk"))) { ## sometimes (rarely) there, but broken |
| 50 |
|
| 51 |
data(faithful) |
| 52 |
tkdensity(faithful $ eruptions) |
| 53 |
|
| 54 |
set.seed(7) |
| 55 |
if(require("nor1mix")) |
| 56 |
tkdensity(rnorMix(1000, MW.nm9), kernels = c("gaussian", "epanechnikov")) |
| 57 |
} |
| 58 |
} |
| 59 |
\keyword{hplot} |
| 60 |
\keyword{dynamic} |