其中的X是T*N*P,Y是T*N,beta是P*1.library(ncvreg)
X=array(runif(N*T*P,-2,2),dim=c(T,N,P))
beta=c(4,5,0,0,2,0,0,-2,0,0)
betaa=array(beta,c(T,N,P))
u=apply(X*betaa,c(1,2),sum)
e=matrix(rnorm(T*N,0,1),nrow=T,ncol=N)
y=u+e
> scad_cv<-cv.ncvreg(X,y,penalty='SCAD')
Error in cv.ncvreg(X, y, penalty = "SCAD") :
X must be a matrix or able to be coerced to a matrix
scad_cv<-cv.ncvreg(X,y,penalty='SCAD',family='mgaussian')
Error in cv.ncvreg(X, y, penalty = "SCAD", family = "mgaussian") :
X must be a matrix or able to be coerced to a matrix