Download presentation
Presentation is loading. Please wait.
Published byAmber Lawrence Modified over 8 years ago
1
Means, Thresholds and Moderation Sarah Medland – Boulder 2008 Corrected Version Thanks to Hongyan Du for pointing out the error on the regression examples
2
This morning Fitting a mean and regression with continuous data Modelling Ordinal data Fitting the regression model with ordinal data
3
Lets start with the data… File: Wednesday.dat Contains 6 of the variables from Dorret’s example ntrid zygMZDZ age1 sekse1 AQ1 age2 sekse2 AQ2
4
Lets start with the data…
5
If this was a pedigree data file… FamidIndFatherMotherZygSexAge Trait 210001xx 220002xx 2312MZ118.1291 2412MZ118.1295
6
How can we make this data file? Assume we have data with 3 variables:
7
How do we make this data? SPSS SORT CASES BY Family Individual. CASESTOVARS /ID = Family /INDEX = Individual /GROUPBY = VARIABLE. SAS? R?
8
Means… In spss sas etc we calculate the mean In Mx and other ML programs we estimate the mean
9
Spss…
11
Mx… Means.mx
13
Spss assumes this is a sample Mx assumes this is a population Slightly different algebra
14
How about regression? Y=X*B +C Regression speak AutismQuotient = Sex*Beta1 + Age*Beta2 + Intercept BG speak AutismQuotient = Sex Effect + Age Effect + Grand Mean
15
Spss…
16
regression.mx
19
Spss…
21
Run regression.mx
23
What does this mean? Age Beta =.549 For every 1 unit increase in Age the mean shifts.549 Grand mean =93.564 Mean Age =18.2 So the mean for 20 year olds is predicted to be: 104.544 = 93.564 + 20*.549
24
Sex effects? Sex Beta = -2.608 Sex coded Male = 1 Female = 0 Female Mean: 93.564 = 93.564 + 0*-2.608 Male Mean: 90.656 = 93.564 + 1*-2.608
25
How do we get the p-values?
26
Set the elements to equal 0 Do this one at a time!
27
So…
28
Why bother with Mx? Because most stat packages can’t handle non-independent data… Non-independence reduces the variance Biases t and F tests
29
Why bother with Mx? Because we want complete flexibility in the model specification… As you see later today
30
Why bother with Mx? Because very few packages can handle ordinal data adequately…
31
Binary data File: two_cat.dat NI=5 Labels Zyg twin1 twin2 Age Sex Trait – smoking initiation Never Smoked/Ever Smoked (Recoded from yesterday) Data is sorted to speed up the analysis
32
Twin 1 smoking initiation
35
Mean =.47 SD =.499 Non Smokers =53%
36
Raw data distribution Mean =.47 SD =.499 Non Smokers =53% Threshold=.53 Standard normal distribution Mean = 0 SD =1 Non Smokers =53% Threshold =.074
37
Threshold =.074 – Huh what? How can I work this out Excell =NORMSINV()
38
Why do we rescale the data this way? Convenience Variance always 1 Mean is always 0 We can interpret the area under a curve between two z-values as a probability or percentage
39
Why do we rescale the data this way? You could use other distributions but you would have to specify the fit function
40
Threshold.mx
41
Threshold =.075 – Huh what?
42
How about age/sex correction?
44
What does this mean? Age Beta =.007 For every 1 unit increase in Age the threshold shifts.007
45
What does this mean? Beta =.007 Threshold is -.1118 38 is +1.38 SD from the mean age The threshold for 38 year olds is:.1544= -.1118 +.007*38 22 is -1.38 SD from the mean age The threshold for 38 year olds is:.0422= -.1118 +.007*22
46
22 year olds Threshold =.0422 38 year olds Threshold =.1544 Is the age effect significant?
47
How to interpret this The threshold moved slightly to the right as age increases This means younger people were more likely to have tried smoking than older people But this was not significant
48
22 year olds Threshold =.548 38 year olds Threshold = 1.028 Is the age effect significant? If Beta =.03
49
How about the sex effect Beta = -.05 Threshold = -.1118 Sex coded Male = 1, Female = 0 So the Male threshold is: -.1618= -.1118 + 1*-.05 The Female threshold is: -.1118 =-.1118 + 0*-.05
50
Female Threshold =-.1118 Male Threshold =-.1618 Are males or females more likely to smoke?
51
Both effects together 38 year old Males:.1042=-.1118 + 1*-.05 +.007*38 38 year old Females:.1542=-.1118 + 0*-.05 +.007*38 22 year old Males: -.0078=-.1118 + 1*-.05 +.007*22 22 year old Females:.0422=-.1118 + 0*-.05 +.007*22
52
Mx Threshold Specification: 3+ Cat. Threshold matrix : T Full 2 2 Free 1st threshold Twin 1 Twin 2 increment
53
Mx Threshold Model : ThresholdsL*T / Threshold matrix : T Full 2 2 Free 1st threshold Twin 1 Twin 2 increment Mx Threshold Specification: 3+ Cat.
54
Mx Threshold Model : ThresholdsL*T / Threshold matrix : T Full 2 2 Free 1st threshold Twin 1 Twin 2 increment 2nd threshold Mx Threshold Specification: 3+ Cat.
55
Adding a regression L*T + G@(D*B); maxth =2, ndef=2, nsib=2, nthr=4
56
Adding a regression
58
Multivariate Threshold Models Specification in Mx Thanks Kate Morley for these slides
59
#define nsib 2! Number of variables * number of siblings = 2 #define maxth 2! Maximum number of thresholds #define nvar 2! Number of variables #define ndef 1 ! Number of definition variables #define nthr 4 ! nsib x nvar #NGROUPS 8 G1: MZ Females Data NInput=8 Ordinal File=data.dat Labels famID zyg covar_a covar_b var1_a var2_a var1_b var2_b Select if zyg = 1 / SELECT covar_a covar_b var1_a var2_a var1_b var2_b / DEFINITION_VARIABLE covar_a covar_b / BEGIN MATRICES; X Lower nvar nvar Free! Genetic paths Y Lower nvar nvar Free! Common environmental paths Z Lower nvar nvar Free! Unique environmental paths H Full 1 1 T Full maxth nthr Free! Thresholds B Full nvar ndef Free ! Regression betas L lower maxth maxth! For converting incremental to cumulative thresholds G Full maxth 1! For duplicating regression betas across thresholds K Full ndef nsib! Contains definition variables END MATRICES;
60
Threshold model for multivariate, multiple category data with definition variables: We will break the algebra into two parts: 1 - Definition variables; 2 - Uncorrected thresholds; and go through it in detail. Part 1Part 2
61
Threshold correction Twin 1 Variable 1 Threshold correction Twin 1 Variable 2 Twin 1 Twin 2 Definition variables Threshold correction Twin 2 Variable 2 Threshold correction Twin 2 Variable 1
62
Transpose:
64
Thresholds 1 & 2 Twin 1 Variable 1 Thresholds 1 & 2 Twin 1 Variable 2 Thresholds 1 & 2 Twin 2 Variable 1 Thresholds 1 & 2 Twin 2 Variable 2
65
=
66
http://davidmlane.com/hyperstat/z _table.html
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.