# Assemble the objects in the list arguments Bmat and surpList
SfdList1 <- Quant_13B_problem_parmList$SfdList[[1]]
Bmat <- SfdList1$Sfd$coef
binctr <- Quant_13B_problem_parmList$binctr
M <- SfdList1$M
Sbasis <- SfdList1$Sfd$basis
Zmat <- SfdList1$Zmat
Sbin <- SfdList1$Sbin
Phimat <- fda::eval.basis(binctr, Sbasis)
Snbasis <- Sbasis$nbasis
Kmat <- matrix(0,Snbasis,Snbasis)
wtvec <- NULL
Bvec <- matrix(Bmat, Snbasis*(M-1),1,byrow=TRUE)
# display coefficient matrix
print(round(Bmat,2))
# set up argument surpList
surpList <- list(binctr=binctr, Sbin=Sbin, wtvec=wtvec,
Kmat=Kmat, Zmat=Zmat, Phimat=Phimat, M=M)
# run surp.fit
result <- surp.fit(Bvec, surpList)
print(paste("Error sum of squares =",round(result$SSE,3)))
print(paste("Gradient norm =",round(norm(result$DSSE),5)))
print("Entropy of item = at bin centres")
print(round(result$Entropy,3))
Run the code above in your browser using DataLab