View source: R/Simulate_Data.R
sim | R Documentation |
Simulate a dataset for the Function Linear Regression model.
sim(param, verbose = FALSE)
param |
a list containing:
|
verbose |
write stuff if TRUE. |
a list containing:
an integer, the number of functional covariates.
a numerical vector, the outcome observations.
a list of matrices, the qth matrix contains the observations of the
qth functional covariate at time points given by grids
.
a list of numerical vectors, the qth vector is the grid of time points for the qth functional covariate.
a list of numerical vectors, the qth vector is the 'true' coefficient
function associated to the qth covariate on a grid of time points
given with grids
.
library(RColorBrewer)
param <- list(Q=2,n=25,p=c(50,50),grids_lim=list(c(0,1),c(-1,2)))
data <- sim(param)
data$y
cols <- colorRampPalette(brewer.pal(9,"YlOrRd"))(10)
q=2
matplot(data$grids[[q]],t(data$x[[q]]),type="l",lty=1,col=cols)
plot(data$grids[[q]],data$betas[[q]],type="l")
abline(h=0,lty=2,col="gray")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.