construct_covmat_single {LTFHPlus} | R Documentation |
Constructing a covariance matrix for a single phenotype
Description
construct_covmatc_single
returns the covariance matrix for an
underlying target individual and a variable number of its family members
Usage
construct_covmat_single(
fam_vec = c("m", "f", "s1", "mgm", "mgf", "pgm", "pgf"),
n_fam = NULL,
add_ind = TRUE,
h2 = 0.5
)
Arguments
fam_vec |
A vector of strings holding the different family members. All family members must be represented by strings from the following list:
|
n_fam |
A named vector holding the desired number of family members.
See |
add_ind |
A logical scalar indicating whether the genetic component of the full liability as well as the full liability for the underlying individual should be included in the covariance matrix. Defaults to TRUE. |
h2 |
A number representing the squared heritability on liability scale for a single phenotype. Must be non-negative and at most 1. Defaults to 0.5. |
Details
This function can be used to construct a covariance matrix for
a given number of family members. Each entry in this covariance
matrix equals the percentage of shared DNA between the corresponding
individuals times the liability-scale heritability h^2
. The family members
can be specified using one of two possible formats.
Value
If either fam_vec
or n_fam
is used as the argument, if it
is of the required format and h2
is a number satisfying
0 \leq h2 \leq 1
, then the output will be a named covariance matrix.
The number of rows and columns corresponds to the length of fam_vec
or n_fam
(+ 2 if add_ind=TRUE
).
If both fam_vec = c()/NULL
and n_fam = c()/NULL
, the
function returns a 2 \times 2
matrix holding only the correlation
between the genetic component of the full liability and
the full liability for the individual. If both fam_vec
and
n_fam
are given, the user is asked to decide on which
of the two vectors to use.
Note that the returned object has different attributes, such as
fam_vec
, n_fam
, add_ind
and h2
.
See Also
get_relatedness
, construct_covmat_multi
,
construct_covmat
Examples
construct_covmat_single()
construct_covmat_single(fam_vec = c("m","mgm","mgf","mhs1","mhs2","mau1"),
n_fam = NULL, add_ind = TRUE, h2 = 0.5)
construct_covmat_single(fam_vec = NULL, n_fam = stats::setNames(c(1,1,1,2,2),
c("m","mgm","mgf","s","mhs")), add_ind = FALSE, h2 = 0.3)