Description Usage Arguments Examples
This function computes the coeffcients of the index function
1 2 | cFuSIM_index(y, xfd, spline_basis, threshold = 1e-05, maxit = 150,
lambda = 10000)
|
y |
a vector of response. |
xfd |
a fda object contains the functional predictor |
spline_basis |
the B-spline basis for the index function |
lambda |
a positive number, the sparsity parameter |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
library(fda)
library(cFuSIM)
data(bike_cFuSIM)
timepts = bike$timepts
norder=4 ## cubic B-spline
nbasis=norder+length(timepts)-2;
spline_basis=create.bspline.basis(rangeval=c(1,24),nbasis#'norder,timepts)
wull = bike$temp
xfds= Data2fd(y=wull%>%t, argvals=bike$timepts)
y = bike$y
train_sample = 1:length(y)
y = y[train_sample]
xfd = xfds[train_sample]
res_c = cFuSIM_index(y, xfd, spline_basis)
beta_fd = fd(res_c$coefBeta, res_c$basisBeta)
plot(beta_fd,ylab="index function", xlab='time')
fdagg(beta_fd)
score_fit = (res_c$score_fit)
pred_y = localpoly.reg(score_fit, y, degree.pol = 1, kernel.type = "gaussian",bandwidth = "CV",deriv=0,points#'score_fit)
plot(x=score_fit, y=y)
lines(pred_y$predicted[order(score_fit)],x=score_fit[order#'score_fit)],col=4)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.