Including covariates in your model

Slides:



Advertisements
Similar presentations
Phenotypic factor analysis
Advertisements

Univariate Model Fitting
1 General Structural Equation (LISREL) Models Week #2 Class #2.
(Re)introduction to OpenMx Sarah Medland. Starting at the beginning  Opening R Gui – double click Unix/Terminal – type R  Closing R Gui – click on the.
Longitudinal Modeling Nathan, Lindon & Mike LongitudinalTwinAnalysis_MatrixRawCon.R GenEpiHelperFunctions.R jepq.txt.
Gene x Environment Interactions Brad Verhulst (With lots of help from slides written by Hermine and Liz) September 30, 2014.
Jul-15H.S.1 Linear Regression Hein Stigum Presentation, data and programs at:
Basic Mathematics for Portfolio Management. Statistics Variables x, y, z Constants a, b Observations {x n, y n |n=1,…N} Mean.
Thresholds and ordinal data Sarah Medland – Boulder 2010.
Ch. 14: The Multiple Regression Model building
Correlation 1. Correlation - degree to which variables are associated or covary. (Changes in the value of one tends to be associated with changes in the.
G Lecture 111 SEM analogue of General Linear Model Fitting structure of mean vector in SEM Numerical Example Growth models in SEM Willett and Sayer.
Karri Silventoinen University of Helsinki Osaka University.
Faculty drive folder Michel. Multivariate analysis Dorret I. Boomsma, Sanja Franic, Michel Nivard Factor analysis (FA) Measurement invariance (MI) Structural.
Moderation & Mediation
Karri Silventoinen University of Helsinki Osaka University.
Brain Mapping Unit The General Linear Model A Basic Introduction Roger Tait
 Go to Faculty/marleen/Boulder2012/Moderating_cov  Copy all files to your own directory  Go to Faculty/sanja/Boulder2012/Moderating_covariances _IQ_SES.
Introduction to OpenMx Sarah Medland. What is OpenMx? Free, Open-source, full–featured SEM package Software which runs on Windows, Mac OSX, and Linux.
Cholesky decomposition May 27th 2015 Helsinki, Finland E. Vuoksimaa.
Ordinal (yet again) Sarah Medland – Boulder 2010.
Regression. Population Covariance and Correlation.
Univariate modeling Sarah Medland. Starting at the beginning… Data preparation – The algebra style used in Mx expects 1 line per case/family – (Almost)
Practical SCRIPT: F:\meike\2010\Multi_prac\MultivariateTwinAnalysis_MatrixRaw.r DATA: DHBQ_bs.dat.
1 Applied biostatistics Francisco Javier Barón López Dpto. Medicina Preventiva Universidad de Málaga – España
Simple Linear Regression. The term linear regression implies that  Y|x is linearly related to x by the population regression equation  Y|x =  +  x.
Categorical Independent Variables STA302 Fall 2013.
Longitudinal Modeling Nathan & Lindon Template_Developmental_Twin_Continuous_Matrix.R Template_Developmental_Twin_Ordinal_Matrix.R jepq.txt GenEpiHelperFunctions.R.
9.1 Chapter 9: Dummy Variables A Dummy Variable: is a variable that can take on only 2 possible values: yes, no up, down male, female union member, non-union.
Introduction to Multiple Regression Lecture 11. The Multiple Regression Model Idea: Examine the linear relationship between 1 dependent (Y) & 2 or more.
Mx modeling of methylation data: twin correlations [means, SD, correlation] ACE / ADE latent factor model regression [sex and age] genetic association.
Means, Thresholds and Moderation Sarah Medland – Boulder 2008 Corrected Version Thanks to Hongyan Du for pointing out the error on the regression examples.
Idiot's guide to... General Linear Model & fMRI Elliot Freeman, ICN. fMRI model, Linear Time Series, Design Matrices, Parameter estimation,
Continuous heterogeneity Danielle Dick & Sarah Medland Boulder Twin Workshop March 2006.
SEM with Measured Genotypes NIDA Workshop VIPBG, October 2012 Maes, H. H., Neale, M. C., Chen, X., Chen, J., Prescott, C. A., & Kendler, K. S. (2011).
Welcome  Log on using the username and password you received at registration  Copy the folder: F:/sarah/mon-morning To your H drive.
More on thresholds Sarah Medland. A plug for OpenMx? Very few packages can handle ordinal data adequately… OpenMx can also be used for more than just.
Introduction to Multivariate Genetic Analysis Danielle Posthuma & Meike Bartels.
March 7, 2012M. de Moor, Twin Workshop Boulder1 Copy files Go to Faculty\marleen\Boulder2012\Multivariate Copy all files to your own directory Go to Faculty\kees\Boulder2012\Multivariate.
Chapter 14 Introduction to Multiple Regression
Ordinal Data Sarah Medland.
Univariate Twin Analysis
Measurement invariance in the linear factor model: practical
B&A ; and REGRESSION - ANCOVA B&A ; and
Introduction to OpenMx
Fitting Univariate Models to Continuous and Categorical Data
Re-introduction to openMx
Gene-Environment Interaction & Correlation
CH 5: Multivariate Methods
Basics of Group Analysis
Ordinal data, matrix algebra & factor analysis
Solving Systems in 3 Variables using Matrices
بحث في التحليل الاحصائي SPSS بعنوان :
More on thresholds Sarah Medland.
Using SPSS for Simple Regression
Univariate modeling Sarah Medland.
Soc 3306a: ANOVA and Regression Models
Linear Regression.
Constantly forgotten Hein Stigum Presentation, data and programs at:
Heterogeneity Danielle Dick, Hermine Maes,
Regression diagnostics
(Re)introduction to Mx Sarah Medland
Longitudinal Modeling
Sarah Medland & Nathan Gillespie
Soc 3306a Lecture 11: Multivariate 4
Sarah Medland faculty/sarah/2018/Tuesday
More on thresholds Sarah Medland.
Lucía Colodro Conde Sarah Medland & Matt Keller
Bivariate Genetic Analysis Practical
Effect of age, sex, race/ethnicity, and obesity on the relation of glycemic measures to Si and AIR. In linear regression models with Si as the dependent.
Presentation transcript:

Including covariates in your model Sarah Medland

Before I forget… http://www.statmethods.net/

The approach up till now… Account for sex by using different means matrices for males and females Ignore other covariates This is a very bad idea… Be guided by the literature Age, Sex, Age2, SES, birthweight…

Can you include a covariate that is in itself influenced by genes? Eg correcting for total brain size when estimating the heritability of specific brain regions Depends on your research question Is it a moderator or a confounder

Accounting or correcting for a covariate Most common method Add a correction in the form of a linear regression to the mean If the covariate is binary code it as 0 vs 1 expMean = intercept + β*covariate Coded 0/1 Mean for the group coded 0 Unstandarised regression B/ the devition of group 1 from group 0

expMean = intercept + β*covariate Coded 0/1 expMean = intercept + β*covariate Mean for the group coded 0 Unstandarised regression B/ the devition of group 1 from group 0

Setting this up in openMx… intercept <- mxMatrix( type="Full", nrow=1, ncol=ntv, free=TRUE, values= 20, label="mean", name="Mean" ) # Matrix for moderating/interacting variable defSex <- mxMatrix( type="Full", nrow=1, ncol=2, free=FALSE, labels=c("data.sex1","data.sex2"), name="Sex") # Matrices declared to store linear Coefficients for covariate B_Sex <- mxMatrix( type="Full", nrow=1, ncol=1, free=TRUE, values= .01, label="betaSex", name="bSex" ) meanSex <- mxAlgebra( bSex%*%Sex, name="SexR") expMean <- mxAlgebra( Mean + SexR + AgeR, name="expMean") defs <- list( intercept, defSex, B_Sex, meanSex)

Setting this up in openMx… intercept <- mxMatrix( type="Full", nrow=1, ncol=ntv, free=TRUE, values= 20, label="mean", name="Mean" ) 1*2 matrix Containing 2 elements 𝑚𝑒𝑎𝑛 𝑚𝑒𝑎𝑛 Start value =20 20 20

Setting this up in openMx… # Matrix for moderating/interacting variable defSex <- mxMatrix( type="Full", nrow=1, ncol=2, free=FALSE, labels=c("data.sex1","data.sex2"), name="Sex") 1*2 matrix Containing 2 elements – the values of sex1 and sex2 𝑠𝑒𝑥1 𝑠𝑒𝑥2 This matrix is repopulated for each family with the actual values of sex1 and sex2

Setting this up in openMx… B_Sex <- mxMatrix( type="Full", nrow=1, ncol=1, free=TRUE, values= .01, label="betaSex", name="bSex" ) 1*1 matrix Containing 1 element – the unstandardise regression beta for sex on bmi 𝐵 𝑠𝑒𝑥 This element will be estimated and has a start value of .01 .01

Setting this up in openMx… meanSex <- mxAlgebra( bSex%*%Sex, name="SexR") 𝐵 𝑠𝑒𝑥 * 𝑠𝑒𝑥1 𝑠𝑒𝑥2 = 𝐵 𝑠𝑒𝑥 .𝑠𝑒𝑥1 𝐵 𝑠𝑒𝑥 .𝑠𝑒𝑥2 expMean <- mxAlgebra( Mean + SexR + AgeR, name="expMean") 𝑚𝑒𝑎𝑛 𝑚𝑒𝑎𝑛 + 𝐵 𝑠𝑒𝑥 .𝑠𝑒𝑥1 𝐵 𝑠𝑒𝑥 .𝑠𝑒𝑥2 = 𝑚𝑒𝑎𝑛+𝐵 𝑠𝑒𝑥 .𝑠𝑒𝑥1 𝑚𝑒𝑎𝑛+𝐵 𝑠𝑒𝑥 .𝑠𝑒𝑥2 Eg: = 20+(.5∗0) 20+(.5∗1) = 20 20.5

Lets give it a go… twinACE.R twinACECovSex.R Does it make a difference to the fit? 3. twinACECovSexAge.R Lets build a script together?