@@ -87,7 +87,7 @@ smooth.surp <- function(argvals, Wbin, Bmat0, WfdPar, wtvec=NULL, conv=1e-4,
87
87
Wbasis <- WfdPar $ fd $ basis
88
88
Wnbasis <- Wbasis $ nbasis
89
89
Wlambda <- WfdPar $ lambda
90
- Wpenalty <- eval.penalty(WfdPar )
90
+ Wpenalty <- eval.penalty(Wbasis , WfdPar $ Lfd )
91
91
92
92
# Check BMAT0, the WNBASIS by M-1 coefficient matrix
93
93
@@ -135,7 +135,7 @@ smooth.surp <- function(argvals, Wbin, Bmat0, WfdPar, wtvec=NULL, conv=1e-4,
135
135
136
136
# Set up list object for data required by PENSSEfun
137
137
138
- dataList <- list (argvals = argvals , Wbin = Wbin , wtvec = wtvec , Kmat = Kmat ,
138
+ surpList <- list (argvals = argvals , Wbin = Wbin , wtvec = wtvec , Kmat = Kmat ,
139
139
Zmat = Zmat , Phimat = Phimat , M = M )
140
140
# --------------------------------------------------------------------
141
141
# loop through variables and curves
@@ -145,7 +145,7 @@ smooth.surp <- function(argvals, Wbin, Bmat0, WfdPar, wtvec=NULL, conv=1e-4,
145
145
# and its derivatives with respect to these coefficients
146
146
147
147
xold <- matrix (Bmat0 , Wnbasis * (M - 1 ),1 )
148
- result <- surp.fit(xold , dataList )
148
+ result <- surp.fit(xold , surpList )
149
149
PENSSE <- result [[1 ]]
150
150
DPENSSE <- result [[2 ]]
151
151
D2PENSSE <- result [[3 ]]
@@ -196,12 +196,12 @@ smooth.surp <- function(argvals, Wbin, Bmat0, WfdPar, wtvec=NULL, conv=1e-4,
196
196
iternum <- iternum + 1
197
197
# take optimal stepsize
198
198
lnsrch_result <-
199
- lnsrch(xold , fold , gvec , pvec , surp.fit , dataList , STEPMAX )
199
+ lnsrch(xold , fold , gvec , pvec , surp.fit , surpList , STEPMAX )
200
200
x <- lnsrch_result $ x
201
201
check <- lnsrch_result $ check
202
202
if (check ) stop(" lnsrch failure" )
203
203
Bmatnew <- matrix (x ,Wnbasis ,M - 1 )
204
- func_result <- surp.fit(Bmatnew , dataList )
204
+ func_result <- surp.fit(Bmatnew , surpList )
205
205
f <- func_result [[1 ]]
206
206
gvec <- func_result [[2 ]]
207
207
hmat <- func_result [[3 ]]
0 commit comments