Skip to content

Commit 0b99bff

Browse files
author
Giles Hooker
committed
fRegressArgCheck fix
1 parent 04f5616 commit 0b99bff

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

R/fRegressArgCheck.R

+29-18
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,33 @@ fRegressArgCheck <- function(yfd, xfdlist, betalist, wt=NULL) {
7070
# "variables are scalar."))
7171
}
7272

73-
# -------------------- check contents of XFDLIST -------------------
73+
74+
75+
# -------------------- check contents of BETALIST -------------------
76+
77+
berror <- FALSE
78+
for (j in 1:p) {
79+
betafdParj <- betalist[[j]]
80+
if (inherits(betafdParj, "fd") || inherits(betafdParj, "basisfd")) {
81+
betafdParj <- fdPar(betafdParj)
82+
betalist[[j]] <- betafdParj
83+
}
84+
if (!inherits(betafdParj, "fdPar")) {
85+
print(paste("BETALIST[[",j,"]] is not a FDPAR object."))
86+
berror <- TRUE
87+
}
88+
}
89+
90+
91+
92+
93+
# -------------------- check contents of XFDLIST -------------------
7494

7595
# If the object is a vector of length N,
7696
# it is converted to a functional data object with a
7797
# constant basis
7898

79-
onebasis <- create.constant.basis(rangeval)
80-
onesfd <- fd(1,onebasis)
99+
81100

82101
xerror <- FALSE
83102
for (j in 1:p) {
@@ -106,30 +125,22 @@ fRegressArgCheck <- function(yfd, xfdlist, betalist, wt=NULL) {
106125
print(paste("Matrix in XFDLIST[[",j,"]] has more than one column."))
107126
xerror = TRUE
108127
}
109-
xfdlist[[j]] <- fd(matrix(xfdj,1,N), onebasis)
128+
xfdlist[[j]] <- fd(matrix(xfdj,1,N), betalist[[j]]$fd$basis)
110129
}
111130
if (!(inherits(xfdlist[[j]], "fd" ) ||
112131
inherits(xfdlist[[j]], "numeric") ||
113132
inherits(xfdlist[[j]], "matrix" ))) {
114133
print(paste("XFDLIST[[",j,"]] is not an FD or numeric or matrix object."))
115134
xerror = TRUE
116135
}
117-
}
136+
}
137+
138+
139+
140+
141+
118142

119-
# -------------------- check contents of BETALIST -------------------
120143

121-
berror <- FALSE
122-
for (j in 1:p) {
123-
betafdParj <- betalist[[j]]
124-
if (inherits(betafdParj, "fd") || inherits(betafdParj, "basisfd")) {
125-
betafdParj <- fdPar(betafdParj)
126-
betalist[[j]] <- betafdParj
127-
}
128-
if (!inherits(betafdParj, "fdPar")) {
129-
print(paste("BETALIST[[",j,"]] is not a FDPAR object."))
130-
berror <- TRUE
131-
}
132-
}
133144

134145
if (xerror || berror) stop(
135146
"An error has been found in either XFDLIST or BETALIST.")

R/pda.fd.R

+5
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,15 @@ pda.fd <- function(xfdlist, bwtlist=NULL, awtlist=NULL, ufdlist=NULL,
358358
}
359359
}
360360

361+
print(dim(barray))
362+
print(length(tx))
363+
print(difeorder)
361364
for (j1 in 1:difeorder) {
365+
print(j1)
362366
if (!is.null(bwtlist[[j1]])) {
363367
bfdParj <- bwtlist[[j1]]
364368
bvecj <- eval.fd(tx, bfdParj$fd)
369+
print(dim(bvecj))
365370
barray[,j1] <- bvecj
366371
}
367372
}

0 commit comments

Comments
 (0)