# \donttest{
#Use purr library to setup
library(purrr)
#Define S matrix
S<-matrix(c(1,1,1,0,0,1),3,2, byrow = TRUE)
#Set data (only 10 training observations used for speed)
data<-map(1:10,function(i){S%*%(c(1,1)+rnorm(2))})
#Set list of functions to generate 50 iterates from probabilistic forecast
prob<-map(1:10,function(i){f<-function(){matrix(rnorm(3*50),3,50)}})
#Find weights by SGD (will take a few seconds)
out<-scoreopt(data,prob,S)
# }
Run the code above in your browser using DataLab