ld.weights: LD weights

Description Usage Arguments Details Value Examples

Description

ld.weights computes LD weights for all markers, which is subsequently used to compute LD weighted GRM.

Usage

1
ld.weights(data, input.genotype = TRUE)

Arguments

data

numeric matrix.

input.genotype

logical.

Details

data can either be the subject by marker numeric genotype matrix (with 0, 1 or 2 coding), or the matrix of marker genotypic correlations. The default option is to input genotype matrix.

Value

A numeric vector of weights. Note that the sum of weights is not constrained to be 1. They should be scaled appropriately before computing the LD weighted GRM.

Examples

1
2
3
4
5
6
7
8
9
# simulate genotypes of 500 individuals at 100 markers
nsnp = 100 # number of SNPs
freq = runif(nsnp, 0.05, 0.95)
nhaplo = 1000 # number of founder haplotypes
haplo.mat = sim.haplotype(freq, nhaplo)
geno.mat = t(sapply(c(1:500), function(x) 4 - haplo.mat[2*x-1,] - haplo.mat[2*x,]))

# compute unconstrained LD weights
ld.weights(geno.mat)

bowenwang7/r3 documentation built on May 17, 2019, 6:39 p.m.