Initial commit.

This commit is contained in:
2016-02-18 14:53:30 +01:00
commit 8e93ca7a95
2215 changed files with 341269 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
Package: pkg1
Type: Package
Title: A sample package for testing ESS
Version: 1.0
Date: 2014-01-20
Author: ESS Core
Maintainer: <yourfault@somewhere.net>
Description: A sample package for testing ESS
License: GPL-2

View File

@@ -0,0 +1 @@
export(D1tr)

View File

@@ -0,0 +1,20 @@
D1tr <- function(y, x = 1)
{
## Purpose: discrete trivial estimate of 1st derivative.
## ----------------------------------------------------------------------
## Arguments: x is optional; let's say we don't like "'"
## ----------------------------------------------------------------------
## Author: Martin Maechler, ~ 1990
n <- length(y)
if(length(x) == 1)
c(y[2] - y[1], 0.5 * (y[-(1:2)] - y[-((n-1):n)]), y[n] - y[n-1])/x
else {
## Here, already using non-matching apostrophes, but developer mode
## still seems to work ..
if(n != length(x)) stop("lengths' of x & 'y' must equal")
if(is.unsorted(x)) stop("'x' must be sorted !")
c(y[2] - y[1], 0.5 * (y[-(1:2)] - y[-((n-1):n)]), y[n] - y[n-1]) /
c(x[2] - x[1], 0.5 * (x[-(1:2)] - x[-((n-1):n)]), x[n] - x[n-1])
}
}

View File

@@ -0,0 +1,36 @@
\name{D1tr}
\alias{D1tr}
\title{Numerical Derivatives of (x,y) Data}
\description{
Compute the numerical derivatives of \eqn{f()} given
observations \code{(x[i], y ~= f(x[i]))}.
\code{D1tr} is the \emph{\bold{tr}ivial} discrete first derivative
using simple difference ratios.
This is \bold{far} from optimal and only kept here for reference.
}
\usage{
D1tr(y, x = 1)
}
\arguments{
\item{x,y}{numeric vectors of same length, supposedly from a model
\code{y ~ f(x)}. For \code{D1tr()}, \code{x} can have length one
and then gets the meaning of \eqn{h = \Delta x}.}
}
\value{
\code{D1tr()} returns a numeric vector of the length of \code{y}.
}
\author{Martin Maechler, in 1992 (for S).}
\seealso{\code{\link[sfsmisc]{D1D2}} which directly uses the 2nd
derivative of the smoothing spline; \code{\link{smooth.spline}}.
}
\examples{
set.seed(330)
x <- sort(runif(500, 0,10))
y <- sin(x) + rnorm(500)/100
f1 <- D1tr(x=x,y=y)
plot(x,f1, ylim = range(c(-1,1, f1)))
curve(cos(x), col=3, add= TRUE)
}
\keyword{smooth}