Description Usage Arguments Value Author(s) See Also Examples
Fits a classical twin model for quantitative traits.
1 2 3 4 |
formula |
Formula specifying effects of covariates on the response. |
data |
|
id |
The name of the column in the dataset containing the twin-id variable. |
zyg |
The name of the column in the dataset containing the zygosity variable. |
DZ |
Character defining the level in the zyg variable corresponding to the dyzogitic twins. If this argument is missing, the reference level (i.e. the first level) will be interpreted as the dyzogitic twins. |
DZos |
Optional. Character defining the level in the zyg variable corresponding to the oppposite sex dyzogitic twins. |
weight |
Weight matrix if needed by the chosen estimator. For use with Inverse Probability Weights |
type |
Character defining the type of analysis to be performed. Should be a subset of "aced" (additive genetic factors, common environmental factors, unique environmental factors, dominant genetic factors). |
twinnum |
The name of the column in the dataset
numbering the twins (1,2). If it does not exist in
|
binary |
If |
probitscale |
Defines the scale in the liability-model |
keep |
Vector of variables from |
estimator |
Choice of estimator/model. |
... |
Additional arguments parsed on to lower-level functions |
Returns an object of class twinlm
.
Klaus K. Holst
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## Simulate data
set.seed(1)
d <- twinsim(2000,b1=c(1,-1),b2=c(),acde=c(1,1,0,1))
## E(y|z1,z2) = z1 - z2. var(A) = var(C) = var(E) = 1
## E.g to fit the data to an ACE-model without any confounders we simply write
ace <- twinlm(y1 ~ 1, data=d, DZ="DZ", zyg="zyg", id="id")
ace
## An AE-model could be fitted as
ae <- twinlm(y1 ~ 1, data=d, DZ="DZ", zyg="zyg", id="id", type="ae")
## LRT:
compare(ae,ace)
## AIC
AIC(ae)-AIC(ace)
## To adjust for the covariates we simply alter the formula statement
ace2 <- twinlm(y1 ~ x11+x12, data=d, DZ="DZ", zyg="zyg", id="id", type="ace")
## Summary/GOF
summary(ace2)
## An interaction could be analyzed as:
ace3 <- twinlm(y1 ~ x11+x12 + x11:I(x12<0), data=d, DZ="DZ", zyg="zyg", id="id", type="ace")
## Categorical variables are also supported
d2 <- transform(d,x12cat=cut(x12,3,labels=c("Low","Med","High")))
ace4 <- twinlm(y1 ~ x11+x12cat, data=d2, DZ="DZ", zyg="zyg", id="id", type="ace")
## plot the model structure
plot(ace4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.