Skip to content

User defined Prediction Equation

Hao Cheng edited this page Jul 22, 2021 · 2 revisions

User-defined Prediction Equation

Predicted values for individuals of interest can be obtained based on a user-defined prediction equation prediction_equation, e.g., "y1:animal + y1:age". For now, genomic data is always included.

Genetic values including effects defined with genotype and pedigree information are returned if prediction_equation=false, defaulting to false.

In the example below, prediction_equation is used and predicted values for individuals of interest is obtained as

y1:intercept + y1:x1 + y1:x2 + y1:x2 + y1:x2*x3 +y1:ID + y1:dam + y1:genotypes

MCMC samples from the posterior distribution of predicted values are saved in MCMC_samples_EBV_y1.txt, and estimated predicted values are saved in EBV_y1.txt.

Example

# Step 1: Load packages
using JWAS,DataFrames,CSV,Statistics,JWAS.Datasets

# Step 2: Read data 
phenofile  = dataset("phenotypes.csv")
pedfile    = dataset("pedigree.csv")
genofile   = dataset("genotypes.csv")
phenotypes = CSV.read(phenofile,DataFrame,delim = ',',header=true,missingstrings=["NA"])
pedigree   = get_pedigree(pedfile,separator=",",header=true);
genotypes  = get_genotypes(genofile,separator=',',method="BayesC");
first(phenotypes,5)

# Step 3: Build Model Equations

model_equation  ="y1 = intercept + x1 + x2 + x2*x3 + ID + dam + genotypes"
model = build_model(model_equation);

# Step 4: Set Factors or Covariates
set_covariate(model,"x1");

# Step 5: Set Random or Fixed Effects
set_random(model,"x2");
set_random(model,"ID dam",pedigree);

# Step 6: Run Analysis
out=runMCMC(model,phenotypes,prediction_equation="y1:intercept + y1:x1 + y1:x2 + y1:x2 + y1:x2*x3 +y1:ID + y1:dam + y1:genotypes");
Clone this wiki locally