Project

General

Profile

« Previous | Next » 

Revision 567d1e54

Added by Benoit Parmentier about 11 years ago

analyses for multi timescale methods paper, part 5, hold out comparisons

View differences:

climate/research/oregon/interpolation/analyses_papers_methods_comparison_part5.R
228 228

  
229 229
### NOW PLOT OF COMPARISON BETWEEN Kriging and GAM
230 230

  
231
xyplot(as.formula(plot_formula),group=pred_mod,type="b",
232
       data=avg_tb,
233
       main=paste("rmse ",plot_name,sep=" "),
234
       pch=1:length(avg_tb$pred_mod),
235
       par.settings=list(superpose.symbol = list(
236
         pch=1:length(avg_tb$pred_mod))),
237
       auto.key=list(columns=5))
231
#Now get
232

  
233
tb_v_gam_CAI
234
tb_v_gam_fus
235
tb_v_kriging_CAI
236
tb_v_kriging_fus
237

  
238
methods_names <- c("tb_v_gam_CAI","tb_v_gam_fus","tb_v_kriging_CAI","tb_v_kriging_fus")
239
list_prop_obj <- vector("list",length=length(methods_names))
240
for(i in 1:length(methods_names)){
241
  tb <- list_tb[[methods_names[i]]]
242
  names_id <- c("pred_mod","prop_month")
243
  names_mod <-unique(tb$pred_mod)
244
  list_prop_obj[[i]] <- calc_stat_prop_tb_diagnostic(names_mod,names_id,tb)
245
  names(list_prop_obj)[i] <- methods_names[i]
246
  #avg_tb <- prop_obj$avg_tb
247
}
248

  
249
ac_prop_tb_list <- extract_list_from_list_obj(list_prop_obj,"avg_tb")
250
nb_rows <- sapply(ac_prop_tb_list,FUN=nrow)
251
method_interp_names<-c("gam_CAI","gam_fus","kriging_CAI","kriging_fus")
252
for(i in 1:length(methods_names)){
253
  avg_tb<-ac_prop_tb_list[[i]]
254
  avg_tb$method_interp <-rep(x=method_interp_names[i],times=nb_rows[i])
255
  ac_prop_tb_list[[i]] <- avg_tb  
256
}
257
#lapply(methods_names,function(i) {rep(x[i],nrows[i],times[i])},times=nb_rows)
258

  
259
#names(ac_prop_tb_list) <- names(list_prop_obj)
260

  
261
t44 <- do.call(rbind,ac_prop_tb_list)
262
View(t44)
263

  
264
t44[which.min(t44$rmse),]
265

  
266
test <- t44[order(t44$rmse),]
267

  
268
test2<-test[test$method_interp%in% c("gam_fus","gam_CAI"),]
269
test2[1:24,]
270
#head(ac_prop_tb)
271

  
272
#list_prop_obj$avg_tb
273
#xyplot(as.formula(plot_formula),group=pred_mod,type="b",
274
#       data=avg_tb,
275
#       main=paste("rmse ",plot_name,sep=" "),
276
#       pch=1:length(avg_tb$pred_mod),
277
#       par.settings=list(superpose.symbol = list(
278
#         pch=1:length(avg_tb$pred_mod))),
279
#       auto.key=list(columns=5))
238 280

  

Also available in: Unified diff