I have 9 data sets, each having 115 rows and 742 columns and each data set contains results from a spectrometer taken under specific conditions.
I would like to analyze all combinations of these 9 data sets to determine the best conditions.
Edit:
The data are spectral measurements(rows= samples,columns =wavelengths) taken at 10 different temperatures.
I would like to get all combinations of the 9 data sets and apply a function cpr2
to each combination. cpr2
takes a data set and makes a plsr model,predicts 9 test sets(the individual sets),and returns bias of prediction.
My intention is to find which combination gave the smallest prediction biases i.e how many temperature conditions are need to give acceptable bias.
Based on suggestion:
I'm looking to do something like this
g<-c("g11","g12","g13,g21","g22","g23","g31","g32","g33")
cbn<-combn(g,3) # making combinations of 3
comb<-lapply(cbn,cpr2(cbn))
for reference cpr2 is
cpr2<-function(data){
data.pls<-plsr(protein~.,8,data=data,validation="LOO") #make plsr model
gag11p.pred<-predict(data.pls,8,newdata=gag11p) #predict each test set
gag12p.pred<-predict(data.pls,8,newdata=gag12p)
gag13p.pred<-predict(data.pls,8,newdata=gag13p)
gag21p.pred<-predict(data.pls,8,newdata=gag21p)
gag22p.pred<-predict(data.pls,8,newdata=gag22p)
gag23p.pred<-predict(data.pls,8,newdata=gag23p)
gag31p.pred<-predict(data.pls,8,newdata=gag31p)
gag32p.pred<-predict(data.pls,8,newdata=gag32p)
gag33p.pred<-predict(data.pls,8,newdata=gag33p)
pred.bias1<-mean(gag11p.pred-gag11p[742]) #calculate prediction bias
pred.bias2<-mean(gag12p.pred-gag12p[742])
pred.bias3<-mean(gag13p.pred-gag13p[742])
pred.bias4<-mean(gag21p.pred-gag21p[742])
pred.bias5<-mean(gag22p.pred-gag22p[742])
pred.bias6<-mean(gag23p.pred-gag23p[742])
pred.bias7<-mean(gag31p.pred-gag31p[742])
pred.bias8<-mean(gag32p.pred-gag32p[742])
pred.bias9<-mean(gag33p.pred-gag33p[742])
r<-signif(c(pred.bias1,pred.bias2,pred.bias3,pred.bias4,pred.bias5,
pred.bias6,pred.bias7,pred.bias8,pred.bias9),2)
out<-c(R2(data.pls,"train",ncomp=8),RMSEP(data.pls,"train",ncomp=8),r)
return(out)
}
Any insights into solving this will be appreciated.