Skip to content

Commit 6b478d3

Browse files
committed
add 5.1.1
1 parent 2bd2159 commit 6b478d3

File tree

363 files changed

+45444
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+45444
-0
lines changed

CHANGELOG

Whitespace-only changes.

DESCRIPTION

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Package: fda
2+
Version: 5.1.1
3+
Date: 2020-03-13
4+
Title: Functional Data Analysis
5+
Author: J. O. Ramsay <ramsay@psych.mcgill.ca> [aut,cre],
6+
Spencer Graves <spencer.graves@effectivedefense.org> [ctb],
7+
Giles Hooker <gjh27@cornell.edu> [ctb]
8+
Maintainer: J. O. Ramsay <ramsay@psych.mcgill.ca>
9+
Depends: R (>= 3.5)
10+
Suggests: deSolve, lattice
11+
Description: These functions were developed to support functional data
12+
analysis as described in Ramsay, J. O. and Silverman, B. W.
13+
(2005) Functional Data Analysis. New York: Springer and in
14+
Ramsay, J. O., Hooker, Giles, and Graves, Spencer (2009).
15+
Functional Data Analysis with R and Matlab (Springer).
16+
The package includes data sets and script files working many examples
17+
including all but one of the 76 figures in this latter book. Matlab versions
18+
are available by ftp from
19+
<http://www.psych.mcgill.ca/misc/fda/downloads/FDAfuns/>.
20+
License: GPL (>= 2)
21+
URL: http://www.functionaldata.org
22+
LazyData: true
23+
NeedsCompilation: no
24+
Packaged: 2020-03-13 15:55:07 UTC; jimramsay

NAMESPACE

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
export(AmpPhaseDecomp,
2+
as.array3,
3+
as.POSIXct1970,
4+
axisIntervals,
5+
axesIntervals,
6+
bifd,
7+
bifdPar,
8+
boxplot.fd,
9+
boxplot.fdPar,
10+
boxplot.fdSmooth,
11+
bsplinepen,
12+
bsplineS,
13+
cca.fd,
14+
center.fd,
15+
checkDim3,
16+
checkDims3,
17+
checkLogical,
18+
checkNumeric,
19+
checkLogicalInteger,
20+
cor.fd,
21+
covPACE,
22+
create.bspline.basis,
23+
create.constant.basis,
24+
create.exponential.basis,
25+
create.fourier.basis,
26+
create.monomial.basis,
27+
create.polygonal.basis,
28+
create.power.basis,
29+
CSTR2in,
30+
CSTR2,
31+
CSTRfitLS,
32+
CSTRfn,
33+
CSTRres,
34+
CSTRsse,
35+
cycleplot.fd,
36+
Data2fd,
37+
density.fd,
38+
deriv.fd,
39+
df2lambda,
40+
dirs,
41+
Eigen,
42+
eigen.pda,
43+
eval.basis,
44+
eval.bifd,
45+
eval.fd,
46+
eval.monfd,
47+
eval.penalty,
48+
eval.posfd,
49+
evaldiag.bifd,
50+
expon,
51+
exponentiate.fd,
52+
exponpen,
53+
fd, fbplot,
54+
fd2list,
55+
fdlabels,
56+
fdPar,
57+
fourier,
58+
fourierpen,
59+
Fperm.fd,
60+
fRegress,
61+
fRegressCV,
62+
fRegressStderr,
63+
Fstat.fd,
64+
geigen,
65+
getbasismatrix,
66+
getbasispenalty,
67+
getbasisrange,
68+
inprod,
69+
inprod.bspline,
70+
int2Lfd,
71+
intensity.fd,
72+
is.basis,
73+
is.fd,
74+
is.fdPar,
75+
is.fdSmooth,
76+
is.Lfd,
77+
lambda2df,
78+
lambda2gcv,
79+
landmarkreg,
80+
Lfd,
81+
lines.fdSmooth,
82+
linmod,
83+
matplot,
84+
matplot.default,
85+
mean.fd,
86+
minus.fd,
87+
monfn,
88+
monomial,
89+
monomialpen,
90+
norder, norder.bspline,
91+
objAndNames,
92+
odesolv,
93+
pca.fd,
94+
pcaPACE,
95+
pda.fd,
96+
pda.overlay,
97+
phaseplanePlot,
98+
plot.cca.fd,
99+
plot.fd,
100+
plot.pca.fd,
101+
plotbeta,
102+
plotfit.fd,
103+
plotfit.fdSmooth,
104+
plotreg.fd,
105+
plotscores,
106+
plus.fd,
107+
polyg,
108+
polygpen,
109+
powerbasis,
110+
powerpen,
111+
ppBspline,
112+
project.basis,
113+
quadset,
114+
reconsCurves,
115+
register.fd,
116+
register.newfd,
117+
scoresPACE,
118+
sd.fd,
119+
std.fd,
120+
stdev.fd,
121+
stddev.fd,
122+
smooth.basis,
123+
smooth.bibasis,
124+
smooth.fd,
125+
smooth.basisPar,
126+
smooth.fdPar,
127+
smooth.monotone,
128+
smooth.morph,
129+
smooth.pos,
130+
smooth.basis.sparse,
131+
smooth.sparse.mean,
132+
sparse.list,
133+
sparse.mat,
134+
svd2,
135+
symsolve,
136+
"[.fd",
137+
times.fd,
138+
tperm.fd,
139+
trapzmat,
140+
var.fd,
141+
varmx,
142+
varmx.cca.fd,
143+
varmx.pca.fd,
144+
vec2Lfd,
145+
wtcheck,
146+
zerofind )
147+
148+
import("graphics")
149+
import("stats")
150+
import("splines")
151+
152+
importFrom("grDevices", "dev.new", "heat.colors")
153+
importFrom("utils", "data")
154+
155+
S3method("==", basisfd)
156+
S3method('*', basisfd)
157+
S3method(summary, basisfd)
158+
S3method(norder, basisfd)
159+
S3method(plot, basisfd)
160+
S3method(predict, basisfd)
161+
S3method('+', fd)
162+
S3method('-', fd)
163+
S3method('*', fd)
164+
S3method('[', fd)
165+
S3method('^', fd)
166+
S3method(boxplot, fd)
167+
S3method(coef, fd)
168+
S3method(coefficients, fd)
169+
S3method(density, fd)
170+
S3method(deriv, fd)
171+
S3method(lines, fd)
172+
S3method(mean, fd)
173+
S3method(norder, fd)
174+
S3method(plot, fd)
175+
S3method(predict, fd)
176+
S3method(sqrt, fd)
177+
S3method(sum, fd)
178+
S3method(summary, fd)
179+
S3method(fRegress, fd)
180+
S3method(boxplot, fdPar)
181+
S3method(coef, fdPar)
182+
S3method(coefficients, fdPar)
183+
S3method(plot, fdPar)
184+
S3method(predict, fdPar)
185+
S3method(summary, fdPar)
186+
S3method(fRegress, fdPar)
187+
S3method(coef, fdSmooth)
188+
S3method(boxplot, fdSmooth)
189+
S3method(coefficients, fdSmooth)
190+
S3method(fitted, fdSmooth)
191+
S3method(lines, fdSmooth)
192+
S3method(residuals, fdSmooth)
193+
S3method(plot, fdSmooth)
194+
S3method(predict, fdSmooth)
195+
S3method(plot, Lfd)
196+
S3method(summary, Lfd)
197+
S3method(fitted, monfd)
198+
S3method(residuals, monfd)
199+
S3method(predict, monfd)
200+
S3method(fRegress, numeric)
201+
S3method(matplot, numeric)
202+
S3method(fitted, posfd)
203+
S3method(predict, posfd)
204+
S3method(residuals, posfd)
205+
S3method(matplot, Date)
206+
S3method(fRegress, character)
207+
S3method(fRegress, formula)
208+
S3method(matplot, default)
209+
S3method(matplot, POSIXct)
210+
S3method(norder, bspline)
211+
S3method(norder, default)
212+
S3method(plot, cca.fd)
213+
S3method(plot, pca.fd)
214+
S3method(plot, pda.fd)
215+
S3method(summary, bifd)

NEWS

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Software and datasets to support three books:
2+
3+
James O. Ramsay, Giles Hooker, and Spencer Graves
4+
(2009) Functional DAta Analysis with R and Matlab
5+
(Springer)
6+
James O. Ramsay and Bernard W. Silverman (2005),
7+
'Functional Data Analysis', 2nd ed. (Springer)
8+
_______ (2002) 'Applied Functional Data Analysis' (Springer)
9+
James O. Ramsay, Giles Hooker, and Spencer Graves (2009)
10+
'Functional Data Analysis with R and Matlab' (Springer)
11+
12+
Release 5.1.1 updates the package to conform to current CRAN requirements.
13+
Changes are:
14+
1. function Data2fd has been temporarily removed. We are considering whether
15+
its contribution to the package is useful given the smoothing function
16+
smooth.basis.
17+
2. functions fRegress.CV and fRgress.stderr have been changed to
18+
fRegressCV and fRegressStderr to avoid collisons with S3 methods.
19+
These functions are not methods for function fRegress.

R/AmpPhaseDecomp.R

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
AmpPhaseDecomp <- function(xfd, yfd, hfd, rng=xrng)
2+
{
3+
# Computes the amplitude-phase decomposition for a registration.
4+
5+
# Arguments:
6+
# XFD ... FD object for unregistered functions
7+
# YFD ... FD object for registered functions
8+
# HFD ... FD object for warping functions
9+
10+
# Returns:
11+
# MS.amp ... mean square for amplitude variation
12+
# MS.pha ... mean square for amplitude variation
13+
# RSQR ... squared correlation measure of prop. phase variation
14+
# C ... constant C
15+
16+
# Last modified 6 January 2020 by Jim Ramsay
17+
18+
xbasis <- xfd$basis
19+
nxbasis <- xbasis$nbasis
20+
nfine <- max(201,10*nxbasis)
21+
xrng <- xbasis$rangeval
22+
23+
if (rng[1] < xrng[1] || rng[2] > xrng[2]) stop(
24+
"RNG is not within the range of the other arguments.")
25+
if (rng[1] >= rng[2]) stop("Elements of rng are not increasing.")
26+
tfine <- seq(rng[1],rng[2],len=nfine)
27+
delta <- tfine[2] - tfine[1]
28+
29+
Dhfine <- eval.fd(tfine, hfd, 1)
30+
xfine <- eval.fd(tfine, xfd, 0)
31+
yfine <- eval.fd(tfine, yfd, 0)
32+
mufine <- apply(xfine, 1, mean)
33+
etafine <- apply(yfine, 1, mean)
34+
35+
N <- dim(xfine)[2]
36+
rfine <- yfine - outer(etafine,rep(1,N))
37+
38+
intetasqr <- delta*trapz(etafine^2)
39+
intmusqr <- delta*trapz(mufine^2)
40+
41+
covDhSy <- rep(0,nfine)
42+
for (i in 1:nfine) {
43+
Dhi <- Dhfine[i,]
44+
Syi <- yfine[i,]^2
45+
covDhSy[i] <- cov(Dhi, Syi)
46+
}
47+
intcovDhSy <- delta*trapz(covDhSy)
48+
49+
intysqr <- rep(0,N)
50+
intrsqr <- rep(0,N)
51+
for (i in 1:N) {
52+
intysqr[i] <- delta*trapz(yfine[,i]^2)
53+
intrsqr[i] <- delta*trapz(rfine[,i]^2)
54+
}
55+
56+
C <- 1 + intcovDhSy/mean(intysqr)
57+
MS.amp <- C*mean(intrsqr)
58+
MS.pha <- C*intetasqr - intmusqr
59+
RSQR <- MS.pha/(MS.amp+MS.pha)
60+
61+
return(list("MS.amp" = MS.amp, "MS.pha" = MS.pha, "RSQR" = RSQR, "C" = C))
62+
63+
}
64+
65+
trapz = function(x) {
66+
n = length(x)
67+
intx = sum(x) - 0.5*(x[1]+x[n])
68+
return(intx)
69+
}
70+

R/CSTR2.R

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
CSTR2 <- function(Time, y, parms){
2+
#function [Dy, DDy] = CSTR2(Time, y, parms)
3+
#% CSTR2 is called by the ODE solving function and evaluates the
4+
#% right hand side of the equation.
5+
#
6+
# 'lsoda' requires this function to return a list
7+
# whose first component is a vector giving the derivatives of 'y'
8+
# with respect to 'Time' and
9+
# whose second component (if any) "is a vector ... of global values
10+
# that are required at each point in 'Time'".
11+
# CSTR2 provides no second component.
12+
13+
#% R port 20 April 2007 by Spencer Graves
14+
#% Matlab version last modified 5 May 2005
15+
16+
tau = 1;
17+
18+
#[F,CA0,T0,Tcin,Fc] = CSTR2in(Time, condition, tau);
19+
CSTR.in <- CSTR2in(Time, parms$condition, tau)
20+
21+
fitstruct <- parms$fitstruct
22+
kref = fitstruct$kref;
23+
EoverR = fitstruct$EoverR;
24+
a = fitstruct$a;
25+
b = fitstruct$b;
26+
27+
V = fitstruct$V;
28+
FoverV = CSTR.in[, "F."]/V;
29+
30+
aFc2bp = a*CSTR.in[, "Fc"]^b;
31+
const1 = V*fitstruct$rho*fitstruct$Cp;
32+
const2 = 2*fitstruct$rhoc*fitstruct$Cpc;
33+
34+
betaTTcin = (CSTR.in[, "Fc"]*aFc2bp/(
35+
const1*(CSTR.in[, "Fc"]+aFc2bp/const2)) )
36+
betaTT0 = FoverV;
37+
38+
#% set up current values of variables
39+
{
40+
if( length(y) == 2 ){
41+
Ci = y[1];
42+
Ti = y[2];
43+
}
44+
else{
45+
Ci = y[,1];
46+
Ti = y[,2];
47+
}
48+
}
49+
# end if(length(y)==2)
50+
51+
Tdif = 1/as.vector(Ti) - 1/fitstruct$Tref;
52+
betaCC = kref*exp(-1e4*EoverR*Tdif);
53+
betaTC = (-fitstruct$delH/const1)*betaCC;
54+
betaTT = FoverV + betaTTcin;
55+
56+
DC = (-(FoverV + betaCC)*as.vector(Ci) +
57+
(CSTR.in[, "F."]/V)*CSTR.in[, "CA0"]);
58+
DT = (-betaTT*Ti + betaTC*Ci + (CSTR.in[, "F."]/V) *
59+
CSTR.in[, "T0"] + betaTTcin*CSTR.in[, "Tcin"]) ;
60+
#
61+
x <- cbind(Conc=DC, Temp=DT)
62+
#
63+
list(x)
64+
}

0 commit comments

Comments
 (0)