sciruby 0.1.3 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/CHANGES +3 -0
- data/CONTRIBUTING.md +46 -0
- data/Gemfile +34 -0
- data/LICENSE.txt +21 -0
- data/README.rdoc +28 -0
- data/lib/sciruby/gems.rb +27 -0
- data/lib/sciruby/version.rb +3 -0
- data/lib/sciruby.rb +2 -77
- data/sciruby.gemspec +35 -0
- metadata +51 -413
- data/.autotest +0 -23
- data/.gemtest +0 -0
- data/History.txt +0 -6
- data/Manifest.txt +0 -119
- data/Rakefile +0 -178
- data/bin/sciruby-plotter +0 -12
- data/data/r/man/AirPassengers.Rd +0 -51
- data/data/r/man/BJsales.Rd +0 -34
- data/data/r/man/BOD.Rd +0 -53
- data/data/r/man/ChickWeight.Rd +0 -68
- data/data/r/man/DNase.Rd +0 -63
- data/data/r/man/EuStockMarkets.Rd +0 -28
- data/data/r/man/Formaldehyde.Rd +0 -44
- data/data/r/man/HairEyeColor.Rd +0 -77
- data/data/r/man/Harman23.cor.Rd +0 -25
- data/data/r/man/Harman74.cor.Rd +0 -28
- data/data/r/man/Indometh.Rd +0 -57
- data/data/r/man/InsectSprays.Rd +0 -45
- data/data/r/man/JohnsonJohnson.Rd +0 -37
- data/data/r/man/LakeHuron.Rd +0 -27
- data/data/r/man/LifeCycleSavings.Rd +0 -54
- data/data/r/man/Loblolly.Rd +0 -56
- data/data/r/man/Nile.Rd +0 -78
- data/data/r/man/Orange.Rd +0 -57
- data/data/r/man/OrchardSprays.Rd +0 -62
- data/data/r/man/PlantGrowth.Rd +0 -39
- data/data/r/man/Puromycin.Rd +0 -84
- data/data/r/man/Theoph.Rd +0 -84
- data/data/r/man/Titanic.Rd +0 -73
- data/data/r/man/ToothGrowth.Rd +0 -40
- data/data/r/man/UCBAdmissions.Rd +0 -68
- data/data/r/man/UKDriverDeaths.Rd +0 -72
- data/data/r/man/UKLungDeaths.Rd +0 -40
- data/data/r/man/UKgas.Rd +0 -25
- data/data/r/man/USAccDeaths.Rd +0 -23
- data/data/r/man/USArrests.Rd +0 -45
- data/data/r/man/USJudgeRatings.Rd +0 -38
- data/data/r/man/USPersonalExpenditure.Rd +0 -33
- data/data/r/man/VADeaths.Rd +0 -51
- data/data/r/man/WWWusage.Rd +0 -41
- data/data/r/man/WorldPhones.Rd +0 -40
- data/data/r/man/ability.cov.Rd +0 -50
- data/data/r/man/airmiles.Rd +0 -29
- data/data/r/man/airquality.Rd +0 -56
- data/data/r/man/anscombe.Rd +0 -62
- data/data/r/man/attenu.Rd +0 -66
- data/data/r/man/attitude.Rd +0 -48
- data/data/r/man/austres.Rd +0 -22
- data/data/r/man/beavers.Rd +0 -73
- data/data/r/man/cars.Rd +0 -59
- data/data/r/man/chickwts.Rd +0 -47
- data/data/r/man/co2.Rd +0 -43
- data/data/r/man/crimtab.Rd +0 -129
- data/data/r/man/datasets-package.Rd +0 -24
- data/data/r/man/discoveries.Rd +0 -30
- data/data/r/man/esoph.Rd +0 -66
- data/data/r/man/euro.Rd +0 -56
- data/data/r/man/eurodist.Rd +0 -25
- data/data/r/man/faithful.Rd +0 -63
- data/data/r/man/freeny.Rd +0 -56
- data/data/r/man/infert.Rd +0 -56
- data/data/r/man/iris.Rd +0 -62
- data/data/r/man/islands.Rd +0 -29
- data/data/r/man/lh.Rd +0 -22
- data/data/r/man/longley.Rd +0 -56
- data/data/r/man/lynx.Rd +0 -33
- data/data/r/man/morley.Rd +0 -50
- data/data/r/man/mtcars.Rd +0 -44
- data/data/r/man/nhtemp.Rd +0 -30
- data/data/r/man/nottem.Rd +0 -30
- data/data/r/man/occupationalStatus.Rd +0 -44
- data/data/r/man/precip.Rd +0 -31
- data/data/r/man/presidents.Rd +0 -36
- data/data/r/man/pressure.Rd +0 -41
- data/data/r/man/quakes.Rd +0 -40
- data/data/r/man/randu.Rd +0 -46
- data/data/r/man/rivers.Rd +0 -21
- data/data/r/man/rock.Rd +0 -34
- data/data/r/man/sleep.Rd +0 -51
- data/data/r/man/stackloss.Rd +0 -77
- data/data/r/man/state.Rd +0 -80
- data/data/r/man/sunspot.month.Rd +0 -49
- data/data/r/man/sunspot.year.Rd +0 -26
- data/data/r/man/sunspots.Rd +0 -33
- data/data/r/man/swiss.Rd +0 -79
- data/data/r/man/treering.Rd +0 -38
- data/data/r/man/trees.Rd +0 -48
- data/data/r/man/uspop.Rd +0 -27
- data/data/r/man/volcano.Rd +0 -31
- data/data/r/man/warpbreaks.Rd +0 -56
- data/data/r/man/women.Rd +0 -40
- data/data/r/man/zCO2.Rd +0 -81
- data/lib/ext/csv.rb +0 -22
- data/lib/ext/shoes.rb +0 -131
- data/lib/ext/string.rb +0 -39
- data/lib/sciruby/analysis/suite.rb +0 -87
- data/lib/sciruby/analysis/suite_report_builder.rb +0 -44
- data/lib/sciruby/analysis.rb +0 -98
- data/lib/sciruby/config.rb +0 -93
- data/lib/sciruby/data/guardian.rb +0 -96
- data/lib/sciruby/data/r/base.rb +0 -110
- data/lib/sciruby/data/r/data_frame.rb +0 -24
- data/lib/sciruby/data/r/grouped_data.rb +0 -7
- data/lib/sciruby/data/r/list.rb +0 -20
- data/lib/sciruby/data/r/multi_time_series.rb +0 -24
- data/lib/sciruby/data/r/r_matrix.rb +0 -7
- data/lib/sciruby/data/r/time_series.rb +0 -19
- data/lib/sciruby/data/r/time_series_base.rb +0 -40
- data/lib/sciruby/data/r/vector.rb +0 -125
- data/lib/sciruby/data/r.rb +0 -155
- data/lib/sciruby/data.rb +0 -168
- data/lib/sciruby/editor.rb +0 -82
- data/lib/sciruby/plotter.rb +0 -128
- data/lib/sciruby/recommend.rb +0 -70
- data/lib/sciruby/validation.rb +0 -368
- data/readme.md +0 -75
- data/static/sciruby-icon.png +0 -0
- data/test/helpers_tests.rb +0 -58
- data/test/test_recommend.rb +0 -16
data/data/r/man/Indometh.Rd
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/Indometh.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2011 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{Indometh}
|
7
|
-
\docType{data}
|
8
|
-
\alias{Indometh}
|
9
|
-
\title{Pharmacokinetics of Indomethacin}
|
10
|
-
\description{
|
11
|
-
The \code{Indometh} data frame has 66 rows and 3 columns of data on
|
12
|
-
the pharmacokinetics of indometacin (or, older spelling,
|
13
|
-
\sQuote{indomethacin}).
|
14
|
-
}
|
15
|
-
\usage{Indometh}
|
16
|
-
\format{
|
17
|
-
This object of class \code{c("nfnGroupedData", "nfGroupedData",
|
18
|
-
"groupedData", "data.frame")} containing the following columns:
|
19
|
-
\describe{
|
20
|
-
\item{Subject}{
|
21
|
-
an ordered factor with containing the subject codes. The
|
22
|
-
ordering is according to increasing maximum response.
|
23
|
-
}
|
24
|
-
\item{time}{
|
25
|
-
a numeric vector of times at which blood samples were drawn (hr).
|
26
|
-
}
|
27
|
-
\item{conc}{
|
28
|
-
a numeric vector of plasma concentrations of indometacin (mcg/ml).
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
\details{
|
33
|
-
Each of the six subjects were given an intravenous injection of
|
34
|
-
indometacin.
|
35
|
-
|
36
|
-
This dataset was originally part of package \code{nlme}, and that has
|
37
|
-
methods (including for \code{[}, \code{as.data.frame}, \code{plot} and
|
38
|
-
\code{print}) for its grouped-data classes.
|
39
|
-
}
|
40
|
-
\source{
|
41
|
-
Kwan, Breault, Umbenhauer, McMahon and Duggan (1976)
|
42
|
-
Kinetics of Indomethacin absorption, elimination, and
|
43
|
-
enterohepatic circulation in man.
|
44
|
-
\emph{Journal of Pharmacokinetics and Biopharmaceutics} \bold{4},
|
45
|
-
255--280.
|
46
|
-
|
47
|
-
Davidian, M. and Giltinan, D. M. (1995)
|
48
|
-
\emph{Nonlinear Models for Repeated Measurement Data},
|
49
|
-
Chapman & Hall (section 5.2.4, p. 129)
|
50
|
-
|
51
|
-
Pinheiro, J. C. and Bates, D. M. (2000) \emph{Mixed-effects Models in
|
52
|
-
S and S-PLUS}, Springer.
|
53
|
-
}
|
54
|
-
\seealso{
|
55
|
-
\code{\link{SSbiexp}} for models fitted to this dataset.
|
56
|
-
}
|
57
|
-
\keyword{datasets}
|
data/data/r/man/InsectSprays.Rd
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/InsectSprays.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2007 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{InsectSprays}
|
7
|
-
\docType{data}
|
8
|
-
\alias{InsectSprays}
|
9
|
-
\title{Effectiveness of Insect Sprays}
|
10
|
-
\description{
|
11
|
-
The counts of insects in agricultural experimental units treated with
|
12
|
-
different insecticides.
|
13
|
-
}
|
14
|
-
\usage{InsectSprays}
|
15
|
-
\format{
|
16
|
-
A data frame with 72 observations on 2 variables.
|
17
|
-
\tabular{rlll}{
|
18
|
-
[,1] \tab count \tab numeric \tab Insect count\cr
|
19
|
-
[,2] \tab spray \tab factor \tab The type of spray
|
20
|
-
}
|
21
|
-
}
|
22
|
-
\source{
|
23
|
-
Beall, G., (1942)
|
24
|
-
The Transformation of data from entomological field experiments,
|
25
|
-
\emph{Biometrika}, \bold{29}, 243--262.
|
26
|
-
}
|
27
|
-
\references{
|
28
|
-
McNeil, D. (1977) \emph{Interactive Data Analysis}.
|
29
|
-
New York: Wiley.
|
30
|
-
}
|
31
|
-
\examples{
|
32
|
-
require(stats); require(graphics)
|
33
|
-
boxplot(count ~ spray, data = InsectSprays,
|
34
|
-
xlab = "Type of spray", ylab = "Insect count",
|
35
|
-
main = "InsectSprays data", varwidth = TRUE, col = "lightgray")
|
36
|
-
fm1 <- aov(count ~ spray, data = InsectSprays)
|
37
|
-
summary(fm1)
|
38
|
-
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
|
39
|
-
plot(fm1)
|
40
|
-
fm2 <- aov(sqrt(count) ~ spray, data = InsectSprays)
|
41
|
-
summary(fm2)
|
42
|
-
plot(fm2)
|
43
|
-
par(opar)
|
44
|
-
}
|
45
|
-
\keyword{datasets}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/JohnsonJohnson.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2007 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{JohnsonJohnson}
|
7
|
-
\docType{data}
|
8
|
-
\alias{JohnsonJohnson}
|
9
|
-
\title{Quarterly Earnings per Johnson & Johnson Share}
|
10
|
-
\description{
|
11
|
-
Quarterly earnings (dollars) per Johnson & Johnson share 1960--80.
|
12
|
-
}
|
13
|
-
\usage{JohnsonJohnson}
|
14
|
-
\format{
|
15
|
-
A quarterly time series
|
16
|
-
}
|
17
|
-
\source{
|
18
|
-
Shumway, R. H. and Stoffer, D. S. (2000)
|
19
|
-
\emph{Time Series Analysis and its Applications}.
|
20
|
-
Second Edition. Springer. Example 1.1.
|
21
|
-
}
|
22
|
-
\examples{\donttest{
|
23
|
-
require(stats); require(graphics)
|
24
|
-
JJ <- log10(JohnsonJohnson)
|
25
|
-
plot(JJ)
|
26
|
-
## This example gives a possible-non-convergence warning on some
|
27
|
-
## platforms, but does seem to converge on x86 Linux and Windows.
|
28
|
-
(fit <- StructTS(JJ, type="BSM"))
|
29
|
-
tsdiag(fit)
|
30
|
-
sm <- tsSmooth(fit)
|
31
|
-
plot(cbind(JJ, sm[, 1], sm[, 3]-0.5), plot.type = "single",
|
32
|
-
col = c("black", "green", "blue"))
|
33
|
-
abline(h = -0.5, col = "grey60")
|
34
|
-
|
35
|
-
monthplot(fit)
|
36
|
-
}}
|
37
|
-
\keyword{datasets}
|
data/data/r/man/LakeHuron.Rd
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/LakeHuron.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2007 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{LakeHuron}
|
7
|
-
\docType{data}
|
8
|
-
\alias{LakeHuron}
|
9
|
-
\title{Level of Lake Huron 1875--1972}
|
10
|
-
\description{
|
11
|
-
Annual measurements of the level, in feet, of Lake Huron 1875--1972.
|
12
|
-
}
|
13
|
-
\usage{LakeHuron}
|
14
|
-
\format{
|
15
|
-
A time series of length 98.
|
16
|
-
}
|
17
|
-
\source{
|
18
|
-
Brockwell, P. J. and Davis, R. A. (1991).
|
19
|
-
\emph{Time Series and Forecasting Methods}.
|
20
|
-
Second edition. Springer, New York. Series A, page 555.
|
21
|
-
|
22
|
-
Brockwell, P. J. and Davis, R. A. (1996).
|
23
|
-
\emph{Introduction to Time Series and Forecasting}.
|
24
|
-
Springer, New York.
|
25
|
-
Sections 5.1 and 7.6.
|
26
|
-
}
|
27
|
-
\keyword{datasets}
|
@@ -1,54 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/LifeCycleSavings.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2007 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{LifeCycleSavings}
|
7
|
-
\docType{data}
|
8
|
-
\alias{LifeCycleSavings}
|
9
|
-
\title{Intercountry Life-Cycle Savings Data}
|
10
|
-
\description{
|
11
|
-
Data on the savings ratio 1960--1970.
|
12
|
-
}
|
13
|
-
\usage{LifeCycleSavings}
|
14
|
-
\format{
|
15
|
-
A data frame with 50 observations on 5 variables.
|
16
|
-
\tabular{rlll}{
|
17
|
-
[,1] \tab sr \tab numeric \tab aggregate personal savings \cr
|
18
|
-
[,2] \tab pop15 \tab numeric \tab \% of population under 15 \cr
|
19
|
-
[,3] \tab pop75 \tab numeric \tab \% of population over 75 \cr
|
20
|
-
[,4] \tab dpi \tab numeric \tab real per-capita disposable
|
21
|
-
income \cr
|
22
|
-
[,5] \tab ddpi \tab numeric \tab \% growth rate of dpi
|
23
|
-
}
|
24
|
-
}
|
25
|
-
\source{
|
26
|
-
The data were obtained from Belsley, Kuh and Welsch (1980).
|
27
|
-
They in turn obtained the data from Sterling (1977).
|
28
|
-
}
|
29
|
-
\details{
|
30
|
-
Under the life-cycle savings hypothesis as developed by Franco
|
31
|
-
Modigliani, the savings ratio (aggregate personal saving divided by
|
32
|
-
disposable income) is explained by per-capita disposable income, the
|
33
|
-
percentage rate of change in per-capita disposable income, and two
|
34
|
-
demographic variables: the percentage of population less than 15
|
35
|
-
years old and the percentage of the population over 75 years old.
|
36
|
-
The data are averaged over the decade 1960--1970 to remove the
|
37
|
-
business cycle or other short-term fluctuations.
|
38
|
-
}
|
39
|
-
\references{
|
40
|
-
Sterling, Arnie (1977) Unpublished BS Thesis.
|
41
|
-
Massachusetts Institute of Technology.
|
42
|
-
|
43
|
-
Belsley, D. A., Kuh. E. and Welsch, R. E. (1980)
|
44
|
-
\emph{Regression Diagnostics}.
|
45
|
-
New York: Wiley.
|
46
|
-
}
|
47
|
-
\examples{
|
48
|
-
require(stats); require(graphics)
|
49
|
-
pairs(LifeCycleSavings, panel = panel.smooth,
|
50
|
-
main = "LifeCycleSavings data")
|
51
|
-
fm1 <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
|
52
|
-
summary(fm1)
|
53
|
-
}
|
54
|
-
\keyword{datasets}
|
data/data/r/man/Loblolly.Rd
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/Loblolly.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2011 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{Loblolly}
|
7
|
-
\docType{data}
|
8
|
-
\alias{Loblolly}
|
9
|
-
\title{Growth of Loblolly pine trees}
|
10
|
-
\description{
|
11
|
-
The \code{Loblolly} data frame has 84 rows and 3 columns of records of
|
12
|
-
the growth of Loblolly pine trees.
|
13
|
-
}
|
14
|
-
\usage{Loblolly}
|
15
|
-
\format{
|
16
|
-
This object of class \code{c("nfnGroupedData", "nfGroupedData",
|
17
|
-
"groupedData", "data.frame")} containing the following columns:
|
18
|
-
\describe{
|
19
|
-
\item{height}{
|
20
|
-
a numeric vector of tree heights (ft).
|
21
|
-
}
|
22
|
-
\item{age}{
|
23
|
-
a numeric vector of tree ages (yr).
|
24
|
-
}
|
25
|
-
\item{Seed}{
|
26
|
-
an ordered factor indicating the seed source for the tree.
|
27
|
-
The ordering is according to increasing maximum height.
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
\details{
|
32
|
-
This dataset was originally part of package \code{nlme}, and that has
|
33
|
-
methods (including for \code{[}, \code{as.data.frame}, \code{plot} and
|
34
|
-
\code{print}) for its grouped-data classes.
|
35
|
-
}
|
36
|
-
\source{
|
37
|
-
Kung, F. H. (1986),
|
38
|
-
Fitting logistic growth curve with predetermined carrying capacity,
|
39
|
-
in \emph{Proceedings of the Statistical Computing Section,
|
40
|
-
American Statistical Association}, 340--343.
|
41
|
-
|
42
|
-
Pinheiro, J. C. and Bates, D. M. (2000)
|
43
|
-
\emph{Mixed-effects Models in S and S-PLUS}, Springer.
|
44
|
-
}
|
45
|
-
\examples{
|
46
|
-
require(stats); require(graphics)
|
47
|
-
plot(height ~ age, data = Loblolly, subset = Seed == 329,
|
48
|
-
xlab = "Tree age (yr)", las = 1,
|
49
|
-
ylab = "Tree height (ft)",
|
50
|
-
main = "Loblolly data and fitted curve (Seed 329 only)")
|
51
|
-
fm1 <- nls(height ~ SSasymp(age, Asym, R0, lrc),
|
52
|
-
data = Loblolly, subset = Seed == 329)
|
53
|
-
age <- seq(0, 30, length.out = 101)
|
54
|
-
lines(age, predict(fm1, list(age = age)))
|
55
|
-
}
|
56
|
-
\keyword{datasets}
|
data/data/r/man/Nile.Rd
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/Nile.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2007 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{Nile}
|
7
|
-
\docType{data}
|
8
|
-
\alias{Nile}
|
9
|
-
\title{Flow of the River Nile}
|
10
|
-
\usage{Nile}
|
11
|
-
\description{
|
12
|
-
Measurements of the annual flow of the river Nile at Ashwan 1871--1970.
|
13
|
-
}
|
14
|
-
\format{
|
15
|
-
A time series of length 100.
|
16
|
-
}
|
17
|
-
\source{
|
18
|
-
Durbin, J. and Koopman, S. J. (2001) \emph{Time Series Analysis by
|
19
|
-
State Space Methods.} Oxford University Press.
|
20
|
-
\url{http://www.ssfpack.com/DKbook.html}
|
21
|
-
}
|
22
|
-
\references{
|
23
|
-
Balke, N. S. (1993) Detecting level shifts in time series.
|
24
|
-
\emph{Journal of Business and Economic Statistics} \bold{11}, 81--92.
|
25
|
-
|
26
|
-
Cobb, G. W. (1978) The problem of the Nile: conditional solution to a
|
27
|
-
change-point problem. \emph{Biometrika} \bold{65}, 243--51.
|
28
|
-
}
|
29
|
-
\examples{
|
30
|
-
require(stats); require(graphics)
|
31
|
-
par(mfrow = c(2,2))
|
32
|
-
plot(Nile)
|
33
|
-
acf(Nile)
|
34
|
-
pacf(Nile)
|
35
|
-
ar(Nile) # selects order 2
|
36
|
-
cpgram(ar(Nile)$resid)
|
37
|
-
par(mfrow = c(1,1))
|
38
|
-
arima(Nile, c(2, 0, 0))
|
39
|
-
|
40
|
-
## Now consider missing values, following Durbin & Koopman
|
41
|
-
NileNA <- Nile
|
42
|
-
NileNA[c(21:40, 61:80)] <- NA
|
43
|
-
arima(NileNA, c(2, 0, 0))
|
44
|
-
plot(NileNA)
|
45
|
-
pred <-
|
46
|
-
predict(arima(window(NileNA, 1871, 1890), c(2,0,0)), n.ahead = 20)
|
47
|
-
lines(pred$pred, lty = 3, col = "red")
|
48
|
-
lines(pred$pred + 2*pred$se, lty=2, col="blue")
|
49
|
-
lines(pred$pred - 2*pred$se, lty=2, col="blue")
|
50
|
-
pred <-
|
51
|
-
predict(arima(window(NileNA, 1871, 1930), c(2,0,0)), n.ahead = 20)
|
52
|
-
lines(pred$pred, lty = 3, col = "red")
|
53
|
-
lines(pred$pred + 2*pred$se, lty=2, col="blue")
|
54
|
-
lines(pred$pred - 2*pred$se, lty=2, col="blue")
|
55
|
-
|
56
|
-
## Structural time series models
|
57
|
-
par(mfrow = c(3, 1))
|
58
|
-
plot(Nile)
|
59
|
-
## local level model
|
60
|
-
(fit <- StructTS(Nile, type = "level"))
|
61
|
-
lines(fitted(fit), lty = 2) # contemporaneous smoothing
|
62
|
-
lines(tsSmooth(fit), lty = 2, col = 4) # fixed-interval smoothing
|
63
|
-
plot(residuals(fit)); abline(h = 0, lty = 3)
|
64
|
-
## local trend model
|
65
|
-
(fit2 <- StructTS(Nile, type = "trend")) ## constant trend fitted
|
66
|
-
pred <- predict(fit, n.ahead = 30)
|
67
|
-
## with 50\% confidence interval
|
68
|
-
ts.plot(Nile, pred$pred,
|
69
|
-
pred$pred + 0.67*pred$se, pred$pred -0.67*pred$se)
|
70
|
-
|
71
|
-
## Now consider missing values
|
72
|
-
plot(NileNA)
|
73
|
-
(fit3 <- StructTS(NileNA, type = "level"))
|
74
|
-
lines(fitted(fit3), lty = 2)
|
75
|
-
lines(tsSmooth(fit3), lty = 3)
|
76
|
-
plot(residuals(fit3)); abline(h = 0, lty = 3)
|
77
|
-
}
|
78
|
-
\keyword{datasets}
|
data/data/r/man/Orange.Rd
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/Orange.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2011 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{Orange}
|
7
|
-
\docType{data}
|
8
|
-
\alias{Orange}
|
9
|
-
\title{Growth of Orange Trees}
|
10
|
-
\description{
|
11
|
-
The \code{Orange} data frame has 35 rows and 3 columns of records of
|
12
|
-
the growth of orange trees.
|
13
|
-
}
|
14
|
-
\usage{Orange}
|
15
|
-
\format{
|
16
|
-
This object of class \code{c("nfnGroupedData", "nfGroupedData",
|
17
|
-
"groupedData", "data.frame")} containing the following columns:
|
18
|
-
\describe{
|
19
|
-
\item{Tree}{
|
20
|
-
an ordered factor indicating the tree on which the measurement is
|
21
|
-
made. The ordering is according to increasing maximum diameter.
|
22
|
-
}
|
23
|
-
\item{age}{
|
24
|
-
a numeric vector giving the age of the tree (days since 1968/12/31)
|
25
|
-
}
|
26
|
-
\item{circumference}{
|
27
|
-
a numeric vector of trunk circumferences (mm). This is probably
|
28
|
-
\dQuote{circumference at breast height}, a standard measurement in
|
29
|
-
forestry.
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
\details{
|
34
|
-
This dataset was originally part of package \code{nlme}, and that has
|
35
|
-
methods (including for \code{[}, \code{as.data.frame}, \code{plot} and
|
36
|
-
\code{print}) for its grouped-data classes.
|
37
|
-
}
|
38
|
-
\source{
|
39
|
-
Draper, N. R. and Smith, H. (1998), \emph{Applied Regression Analysis
|
40
|
-
(3rd ed)}, Wiley (exercise 24.N).
|
41
|
-
|
42
|
-
Pinheiro, J. C. and Bates, D. M. (2000) \emph{Mixed-effects Models
|
43
|
-
in S and S-PLUS}, Springer.
|
44
|
-
}
|
45
|
-
\examples{
|
46
|
-
require(stats); require(graphics)
|
47
|
-
coplot(circumference ~ age | Tree, data = Orange, show.given = FALSE)
|
48
|
-
fm1 <- nls(circumference ~ SSlogis(age, Asym, xmid, scal),
|
49
|
-
data = Orange, subset = Tree == 3)
|
50
|
-
plot(circumference ~ age, data = Orange, subset = Tree == 3,
|
51
|
-
xlab = "Tree age (days since 1968/12/31)",
|
52
|
-
ylab = "Tree circumference (mm)", las = 1,
|
53
|
-
main = "Orange tree data and fitted model (Tree 3 only)")
|
54
|
-
age <- seq(0, 1600, length.out = 101)
|
55
|
-
lines(age, predict(fm1, list(age = age)))
|
56
|
-
}
|
57
|
-
\keyword{datasets}
|
data/data/r/man/OrchardSprays.Rd
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/OrchardSprays.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2007 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{OrchardSprays}
|
7
|
-
\docType{data}
|
8
|
-
\alias{OrchardSprays}
|
9
|
-
\title{Potency of Orchard Sprays}
|
10
|
-
\description{
|
11
|
-
An experiment was conducted to assess the potency of various
|
12
|
-
constituents of orchard sprays in repelling honeybees, using a
|
13
|
-
Latin square design.
|
14
|
-
}
|
15
|
-
\usage{OrchardSprays}
|
16
|
-
\format{
|
17
|
-
A data frame with 64 observations on 4 variables.
|
18
|
-
\tabular{rlll}{
|
19
|
-
[,1] \tab rowpos \tab numeric \tab Row of the design\cr
|
20
|
-
[,2] \tab colpos \tab numeric \tab Column of the design\cr
|
21
|
-
[,3] \tab treatment \tab factor \tab Treatment level\cr
|
22
|
-
[,4] \tab decrease \tab numeric \tab Response
|
23
|
-
}
|
24
|
-
}
|
25
|
-
\details{
|
26
|
-
Individual cells of dry comb were filled with measured amounts of lime
|
27
|
-
sulphur emulsion in sucrose solution. Seven different concentrations
|
28
|
-
of lime sulphur ranging from a concentration of 1/100 to 1/1,562,500
|
29
|
-
in successive factors of 1/5 were used as well as a solution
|
30
|
-
containing no lime sulphur.
|
31
|
-
|
32
|
-
The responses for the different solutions were obtained by releasing
|
33
|
-
100 bees into the chamber for two hours, and then measuring the
|
34
|
-
decrease in volume of the solutions in the various cells.
|
35
|
-
|
36
|
-
An \eqn{8 \times 8}{8 x 8} Latin square design was used and the
|
37
|
-
treatments were coded as follows:
|
38
|
-
\tabular{rl}{
|
39
|
-
A \tab highest level of lime sulphur\cr
|
40
|
-
B \tab next highest level of lime sulphur\cr
|
41
|
-
. \tab \cr
|
42
|
-
. \tab \cr
|
43
|
-
. \tab \cr
|
44
|
-
G \tab lowest level of lime sulphur\cr
|
45
|
-
H \tab no lime sulphur
|
46
|
-
}
|
47
|
-
}
|
48
|
-
\source{
|
49
|
-
Finney, D. J. (1947)
|
50
|
-
\emph{Probit Analysis}.
|
51
|
-
Cambridge.
|
52
|
-
}
|
53
|
-
\references{
|
54
|
-
McNeil, D. R. (1977)
|
55
|
-
\emph{Interactive Data Analysis}.
|
56
|
-
New York: Wiley.
|
57
|
-
}
|
58
|
-
\examples{
|
59
|
-
require(graphics)
|
60
|
-
pairs(OrchardSprays, main = "OrchardSprays data")
|
61
|
-
}
|
62
|
-
\keyword{datasets}
|
data/data/r/man/PlantGrowth.Rd
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/PlantGrowth.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2007 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{PlantGrowth}
|
7
|
-
\docType{data}
|
8
|
-
\alias{PlantGrowth}
|
9
|
-
\title{Results from an Experiment on Plant Growth}
|
10
|
-
\description{
|
11
|
-
Results from an experiment to compare yields (as measured by dried
|
12
|
-
weight of plants) obtained under a control and two different treatment
|
13
|
-
conditions.
|
14
|
-
}
|
15
|
-
\usage{PlantGrowth}
|
16
|
-
\format{
|
17
|
-
A data frame of 30 cases on 2 variables.
|
18
|
-
|
19
|
-
\tabular{rll}{
|
20
|
-
[, 1] \tab weight \tab numeric \cr
|
21
|
-
[, 2] \tab group \tab factor
|
22
|
-
}
|
23
|
-
|
24
|
-
The levels of \code{group} are \sQuote{ctrl}, \sQuote{trt1}, and \sQuote{trt2}.
|
25
|
-
}
|
26
|
-
\examples{
|
27
|
-
## One factor ANOVA example from Dobson's book, cf. Table 7.4:
|
28
|
-
require(stats); require(graphics)
|
29
|
-
boxplot(weight ~ group, data = PlantGrowth, main = "PlantGrowth data",
|
30
|
-
ylab = "Dried weight of plants", col = "lightgray",
|
31
|
-
notch = TRUE, varwidth = TRUE)
|
32
|
-
anova(lm(weight ~ group, data = PlantGrowth))
|
33
|
-
}
|
34
|
-
\source{
|
35
|
-
Dobson, A. J. (1983)
|
36
|
-
\emph{An Introduction to Statistical Modelling}.
|
37
|
-
London: Chapman and Hall.
|
38
|
-
}
|
39
|
-
\keyword{datasets}
|
data/data/r/man/Puromycin.Rd
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/Puromycin.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2010 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{Puromycin}
|
7
|
-
\docType{data}
|
8
|
-
\alias{Puromycin}
|
9
|
-
\title{Reaction Velocity of an Enzymatic Reaction}
|
10
|
-
\description{
|
11
|
-
The \code{Puromycin} data frame has 23 rows and 3 columns of the
|
12
|
-
reaction velocity versus substrate concentration in an enzymatic
|
13
|
-
reaction involving untreated cells or cells treated with Puromycin.
|
14
|
-
}
|
15
|
-
\usage{Puromycin}
|
16
|
-
\format{
|
17
|
-
This data frame contains the following columns:
|
18
|
-
\describe{
|
19
|
-
\item{conc}{
|
20
|
-
a numeric vector of substrate concentrations (ppm)
|
21
|
-
}
|
22
|
-
\item{rate}{
|
23
|
-
a numeric vector of instantaneous reaction rates (counts/min/min)
|
24
|
-
}
|
25
|
-
\item{state}{
|
26
|
-
a factor with levels
|
27
|
-
\code{treated}
|
28
|
-
\code{untreated}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
\details{
|
33
|
-
Data on the velocity of an enzymatic reaction were obtained
|
34
|
-
by Treloar (1974). The number of counts per minute of radioactive
|
35
|
-
product from the reaction was measured as a function of substrate
|
36
|
-
concentration in parts per million (ppm) and from these counts the
|
37
|
-
initial rate (or velocity) of the reaction was calculated
|
38
|
-
(counts/min/min). The experiment was conducted once with the enzyme
|
39
|
-
treated with Puromycin, and once with the enzyme untreated.
|
40
|
-
}
|
41
|
-
\source{
|
42
|
-
Bates, D.M. and Watts, D.G. (1988),
|
43
|
-
\emph{Nonlinear Regression Analysis and Its Applications},
|
44
|
-
Wiley, Appendix A1.3.
|
45
|
-
|
46
|
-
Treloar, M. A. (1974), \emph{Effects of Puromycin on
|
47
|
-
Galactosyltransferase in Golgi Membranes}, M.Sc. Thesis, U. of
|
48
|
-
Toronto.
|
49
|
-
}
|
50
|
-
|
51
|
-
\seealso{
|
52
|
-
\code{\link{SSmicmen}} for other models fitted to this dataset.
|
53
|
-
}
|
54
|
-
\examples{
|
55
|
-
require(stats); require(graphics)
|
56
|
-
\testonly{options(show.nls.convergence=FALSE)}
|
57
|
-
plot(rate ~ conc, data = Puromycin, las = 1,
|
58
|
-
xlab = "Substrate concentration (ppm)",
|
59
|
-
ylab = "Reaction velocity (counts/min/min)",
|
60
|
-
pch = as.integer(Puromycin$state),
|
61
|
-
col = as.integer(Puromycin$state),
|
62
|
-
main = "Puromycin data and fitted Michaelis-Menten curves")
|
63
|
-
## simplest form of fitting the Michaelis-Menten model to these data
|
64
|
-
fm1 <- nls(rate ~ Vm * conc/(K + conc), data = Puromycin,
|
65
|
-
subset = state == "treated",
|
66
|
-
start = c(Vm = 200, K = 0.05))
|
67
|
-
fm2 <- nls(rate ~ Vm * conc/(K + conc), data = Puromycin,
|
68
|
-
subset = state == "untreated",
|
69
|
-
start = c(Vm = 160, K = 0.05))
|
70
|
-
summary(fm1)
|
71
|
-
summary(fm2)
|
72
|
-
## add fitted lines to the plot
|
73
|
-
conc <- seq(0, 1.2, length.out = 101)
|
74
|
-
lines(conc, predict(fm1, list(conc = conc)), lty = 1, col = 1)
|
75
|
-
lines(conc, predict(fm2, list(conc = conc)), lty = 2, col = 2)
|
76
|
-
legend(0.8, 120, levels(Puromycin$state),
|
77
|
-
col = 1:2, lty = 1:2, pch = 1:2)
|
78
|
-
|
79
|
-
## using partial linearity
|
80
|
-
fm3 <- nls(rate ~ conc/(K + conc), data = Puromycin,
|
81
|
-
subset = state == "treated", start = c(K = 0.05),
|
82
|
-
algorithm = "plinear")
|
83
|
-
}
|
84
|
-
\keyword{datasets}
|
data/data/r/man/Theoph.Rd
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
% File src/library/datasets/man/Theoph.Rd
|
2
|
-
% Part of the R package, http://www.R-project.org
|
3
|
-
% Copyright 1995-2011 R Core Development Team
|
4
|
-
% Distributed under GPL 2 or later
|
5
|
-
|
6
|
-
\name{Theoph}
|
7
|
-
\docType{data}
|
8
|
-
\alias{Theoph}
|
9
|
-
\title{Pharmacokinetics of Theophylline}
|
10
|
-
\description{
|
11
|
-
The \code{Theoph} data frame has 132 rows and 5 columns of data from
|
12
|
-
an experiment on the pharmacokinetics of theophylline.}
|
13
|
-
\usage{Theoph}
|
14
|
-
\format{
|
15
|
-
This object of class \code{c("nfnGroupedData", "nfGroupedData",
|
16
|
-
"groupedData", "data.frame")} containing the following columns:
|
17
|
-
\describe{
|
18
|
-
\item{Subject}{
|
19
|
-
an ordered factor with levels \code{1}, \dots, \code{12}
|
20
|
-
identifying the subject on whom the observation was made. The
|
21
|
-
ordering is by increasing maximum concentration of theophylline
|
22
|
-
observed.
|
23
|
-
}
|
24
|
-
\item{Wt}{
|
25
|
-
weight of the subject (kg).
|
26
|
-
}
|
27
|
-
\item{Dose}{
|
28
|
-
dose of theophylline administered orally to the subject (mg/kg).
|
29
|
-
}
|
30
|
-
\item{Time}{
|
31
|
-
time since drug administration when the sample was drawn (hr).
|
32
|
-
}
|
33
|
-
\item{conc}{
|
34
|
-
theophylline concentration in the sample (mg/L).
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
\details{
|
39
|
-
Boeckmann, Sheiner and Beal (1994) report data from a study by
|
40
|
-
Dr. Robert Upton of the kinetics of the anti-asthmatic drug
|
41
|
-
theophylline. Twelve subjects were given oral doses of theophylline
|
42
|
-
then serum concentrations were measured at 11 time points over the
|
43
|
-
next 25 hours.
|
44
|
-
|
45
|
-
These data are analyzed in Davidian and Giltinan (1995) and Pinheiro
|
46
|
-
and Bates (2000) using a two-compartment open pharmacokinetic model,
|
47
|
-
for which a self-starting model function, \code{SSfol}, is available.
|
48
|
-
|
49
|
-
This dataset was originally part of package \code{nlme}, and that has
|
50
|
-
methods (including for \code{[}, \code{as.data.frame}, \code{plot} and
|
51
|
-
\code{print}) for its grouped-data classes.
|
52
|
-
}
|
53
|
-
\source{
|
54
|
-
Boeckmann, A. J., Sheiner, L. B. and Beal, S. L. (1994), \emph{NONMEM
|
55
|
-
Users Guide: Part V}, NONMEM Project Group, University of
|
56
|
-
California, San Francisco.
|
57
|
-
|
58
|
-
Davidian, M. and Giltinan, D. M. (1995) \emph{Nonlinear Models for
|
59
|
-
Repeated Measurement Data}, Chapman & Hall (section 5.5, p. 145 and
|
60
|
-
section 6.6, p. 176)
|
61
|
-
|
62
|
-
Pinheiro, J. C. and Bates, D. M. (2000) \emph{Mixed-effects Models in
|
63
|
-
S and S-PLUS}, Springer (Appendix A.29)
|
64
|
-
}
|
65
|
-
\seealso{\code{\link{SSfol}}}
|
66
|
-
\examples{
|
67
|
-
require(stats); require(graphics)
|
68
|
-
\testonly{options(show.nls.convergence=FALSE)}
|
69
|
-
coplot(conc ~ Time | Subject, data = Theoph, show.given = FALSE)
|
70
|
-
Theoph.4 <- subset(Theoph, Subject == 4)
|
71
|
-
fm1 <- nls(conc ~ SSfol(Dose, Time, lKe, lKa, lCl),
|
72
|
-
data = Theoph.4)
|
73
|
-
summary(fm1)
|
74
|
-
plot(conc ~ Time, data = Theoph.4,
|
75
|
-
xlab = "Time since drug administration (hr)",
|
76
|
-
ylab = "Theophylline concentration (mg/L)",
|
77
|
-
main = "Observed concentrations and fitted model",
|
78
|
-
sub = "Theophylline data - Subject 4 only",
|
79
|
-
las = 1, col = 4)
|
80
|
-
xvals <- seq(0, par("usr")[2], length.out = 55)
|
81
|
-
lines(xvals, predict(fm1, newdata = list(Time = xvals)),
|
82
|
-
col = 4)
|
83
|
-
}
|
84
|
-
\keyword{datasets}
|