FW: An R package for Genomic/Pedigree and Spatial analysis using...

Description Usage Arguments Details Value Author(s) Examples

Description

The FW ("Finlay-Wilkinson") function fits the Finlay-Wilkinson regression with Ordinary least squares method or Bayesian method to continuous traits. Genomic informationa and Spatial correlations can be included in the model.

Usage

1
2
3
4
5
6
FW(y, VAR, ENV, method = c("OLS", 
    "Gibbs")[2], A = NULL, H = NULL, saveAt = "", nIter = 5000, 
    burnIn = 3000, thin = 5, dfe = 5, dfg = 5, dfh = 5, dfb = 5, 
    priorVARe = NULL, priorVARg = NULL, priorVARb = NULL, priorVARh = NULL, 
    nchain = 1, seed = NULL, inits = NULL, saveVAR = c(1:2), 
    saveENV = c(1:2)) 

Arguments

Only the arguments y, VAR, ENV, VARlevels, ENVlevels and method are used for fitting the OLS model. All other arguments are for the Gibbs method.

y

(numeric, n) The data vector (NAs are alllowed).

VAR

(character, n) is a vector whose elements are identifiers for the varieties which are treated as labels (NAs are not allowed).Internally, VAR is coersed to factors.

ENV

(character, n) is a vector whose elements are identifiers for the environments which are treated as labels (NAs are not allowed). Internally, ENV is coersed to factors.

method

Describes what method to use: either "OLS" for ordinary least squares method or "Gibbs" for Bayesian method using Gibbs Sampler. The default is "Gibbs".

A

(numeric, qg*qg), is the covariance structure for Normal distirubion of g and b: N(0, Aσ^2_g), N(b|0,Aσ^2_b). In case A is NULL, A is automatically set to be Identiy matrix

H

(numeric,qh*qh), is the covariance structure for Normal distirubion of h: N(0, Hσ^2_h). In case H is NULL, H will be automatically set to be Identiy matrix

saveAt

(character) can be used to indicate where to store the samples and to provide a pre-fix to be appended to 'samps.rda' (the name of the file where the samples are stored). By default samples are saved in the current working directory and no pre-fix is added to the file names.

nIter, burnIn, thin

(integer) control the number of iterations of the sampler, the number of samples discarded, and the thinning used to compute posterior means.

dfe, dfg, dfh, dfb, priorVARe, priorVARg, priorVARb, priorVARh

(numeric) define the degrees of freedom (df) and prior estimates of variance components (priorVAR) for scaled inverse chi-squared distributions. The scale paramter S^2 is set to be priorVAR(df+2)/df. Details can be found in the vignettes of the software.

nchain

(integer) specifies the number of chains for Gibbs Sampler to run.

seed

(integer vector whose length is equal to the number of chains) is the starting seed for Gibbs Sampler for each chain. If seed=NULL, no seed is set.

inits

(list of named lists) specifies the initial values for Gibbs sampler. Example usage is inits=list(inits1=list(mu=,g=,b=,h=,var_e=,var_g=,var_b=,var_h=),inits2=list(...)). If NULL, default values will be set. Details can be seen in the vignettes of the software.

saveVAR, saveENV

(integer) can be used to specify for which variety or environment the samples of parameter should be saved. For example, saveVAR=c(1,5,10) will save the samples of g and b for variety 1, 5, and 10. By default, only the parameter samples for the first two varieties and first two environments are saved.

Details

Model Specification. FW implements Gibbs sampler (Gibbs) or Ordinary least square (OLS) method to fit the Finlay-Wilkinson regression model. The basic form of statistical model for both OLS and Gibbs methods is the same:

y= μ + g + h + b * h + ε [1]

y is the phenotype performance, μ is the overall mean, g is the main variety effect, h is the main environment effect, b is the variety slope on the environment gradients, ε is the normal residual with mean zero and variance σ^2_ε.

Further details for Model setup and implementation can be found in the vignettes.

Value

A list with estimated posterior means and the parameters used to fit the model.

y

response vector used in the call to FW

whichNa

the position of the entries in y that were missing

VAR

The identifiers for varieties

ENV

The identifiers for environments

VARlevels

the levels of the varieties (the varieties are fitted in the order of the VARlevels)

ENVlevels

levels of the environments (the environments are fitted in the order of the ENVlevels

mu,g,b,h

are the estimated parameters. mu is a vector: with OLS method, mu has only one element; with Gibbs method, each element of mu is an estimate from a different chain. g, b, h are all matrix: with OLS method, g, b, h all have only one column; with Gibbs method, each column of g, b, h provides estimates derived from one MCMC chain.

yhat

(matrix) is the estimates of the predictor: yhat = mu+ g + h + b*h. For OLS, there is only one column for yhat. For Gibbs method, each column of yhat corresponds to a different chain.

SD.mu,SD.g,SD.b,SD.h,SD.yhat

only for Gibbs method, the posterior standard deviation for mu, g, b, h and yhat

var_e

For Gibbs method, the posterior mean of σ^2_ε; For OLS method, a vector of residual variance for each within line linear regression

var_e_weighted

weighted mean of residual variance for each within line regression by its residual degree of freedom

var_g,var_b,var_h

only for Gibbs method, the posterior means for σ^2_g, σ^2_b, σ^2_h

SD.var_e,SD.var_g,SD.var_b,SD.var_h

only for Gibbs method, the posterior standard deviation for σ^2_ε, σ^2_g, σ^2_b, σ^2_h

Author(s)

Lian Lian, Gustavo de los Campos

Examples

1
2
3
4
data(wheat)
attach(wheat.Y)
lm1=FW(y=y[1:100],VAR=VAR[1:100],ENV=ENV[1:100],method="OLS")
lm2=FW(y=y[1:100],VAR=VAR[1:100],ENV=ENV[1:100],method="Gibbs")

lian0090/FW documentation built on May 20, 2019, 5:27 p.m.