HSFWM_est {spFW} | R Documentation |
Estimation Function for Hierarchical Spatial Finlay-Wilkinson Model
Description
This function considers spatial adjustments.
Usage
HSFWM_est(Y, VAR, ENV, COOR, kin_info = FALSE, A = NULL,
env_info = FALSE, Z = NULL, inits = NULL, hyper_para = NULL,
M_iter = 5000, burn_in = 3000, thin = 5, save_chain = FALSE,
seed = NULL)
Arguments
Y |
A length-N numerical response vector |
VAR |
A length-N factor/character vector indicating the genotype information of Y |
ENV |
A length-N factor/character vector indicating the field information of Y |
COOR |
A N by 2 numerical matrix indicating the spatial locations of Y |
kin_info |
A logical parameter controling if to use kinship matrix |
A |
kinship matrix, give value only if kin_info = TRUE |
env_info |
A logical parameter controling whether to use environmental covariates |
Z |
environmental covariates matrix with rownames = field names, give value only if env_info = TRUE |
inits |
initial values, default is given |
hyper_para |
hyper-parameter values, default is given |
M_iter |
Total iteration number |
burn_in |
Burn in number |
thin |
Thinning value |
save_chain |
A logical parameter controling whether to save MCMC chain: 'Chains.rds' in current working directory |
seed |
Random seed value |
Value
Mean estimates and RMSE value
Examples
library(spFW)
# load data
data(spFW_example_data)
Y <- spFW_example_data$yield
VAR <- spFW_example_data$geno
ENV <- spFW_example_data$loc
COOR <- spFW_example_data[,c(4,5)]
# run model
fit1 <- HSFWM_est(Y, VAR, ENV, COOR,
M_iter = 1000, burn_in = 500, thin = 5)
# plot estimated Y
plot(Y, fit1$yhat)