library("masreml")
d <- load_data("small")
y <- d$pheno$y_cont_qtl_snp; names(y) <- d$pheno$id
fit <- masreml(y[d$train_idx],
markers = list(snp_add = d$snp[d$train_idx, ]))
pred <- predict(fit,
markers_new = list(snp_add = d$snp[d$test_idx, ]),
markers_train = list(snp_add = d$snp[d$train_idx, ]))
# Continuous trait — pass TBV for the standard breeding-value accuracy
tbv_te <- d$pheno$tbv_qtl_snp[d$test_idx]; names(tbv_te) <- names(pred$GEBV)
evaluate_prediction(
gebv = pred$GEBV,
y = y[d$test_idx],
h2 = fit$varcomp$h2["snp_add"],
tbv = tbv_te
)