## Not run:
# require(CorReg)
# #dataset generation
# base=mixture_generator(n=15,p=10,ratio=0.4,tp1=1,tp2=1,tp3=1,positive=0.5,
# R2Y=0.8,R2=0.9,scale=TRUE,max_compl=3,lambda=1)
# X_appr=base$X_appr #learning sample
# Y_appr=base$Y_appr #response variable for the learning sample
# Y_test=base$Y_test #responsee variable for the validation sample
# X_test=base$X_test #validation sample
# TrueZ=base$Z#True generative structure (binary adjacency matrix)
#
# #Regression coefficients estimation
# select="lar"#variable selection with lasso (using lar algorithm)
# resY=correg(X=X_appr,Y=Y_appr,Z=TrueZ,compl=TRUE,expl=TRUE,pred=TRUE,
# select=select,K=10)
#
# #MSE computation
# MSE_complete=MSE_loc(Y=Y_test,X=X_test,A=resY$compl$A)#classical model on X
# MSE_marginal=MSE_loc(Y=Y_test,X=X_test,A=resY$expl$A)#reduced model without correlations
# MSE_plugin=MSE_loc(Y=Y_test,X=X_test,A=resY$pred$A)#plug-in model
# MSE_true=MSE_loc(Y=Y_test,X=X_test,A=base$A)# True model
#
#
# #MSE comparison
# MSE=data.frame(MSE_complete,MSE_marginal,MSE_plugin,MSE_true)
# MSE#estimated structure
# compZ$true_left;compZ$false_left
#
# barplot(as.matrix(MSE),main="MSE on validation dataset", sub=paste("select=",select))
# abline(h=MSE_complete,col="red")
# ## End(Not run)
Run the code above in your browser using DataLab