Means, Thresholds and Moderation

66
Means, Thresholds and Moderation Sarah Medland – Boulder 2008 Corrected Version Thanks to Hongyan Du for pointing out the error on the regression examples

description

Means, Thresholds and Moderation. Sarah Medland – Boulder 2008 Corrected Version Thanks to Hongyan Du for pointing out the error on the regression examples. This morning. Fitting a mean and regression with continuous data Modelling Ordinal data Fitting the regression model with ordinal data. - PowerPoint PPT Presentation

Transcript of Means, Thresholds and Moderation

Page 1: Means, Thresholds and Moderation

Means, Thresholds and Moderation

Sarah Medland – Boulder 2008Corrected VersionThanks to Hongyan Du for pointing out the error on the regression examples

Page 2: Means, Thresholds and Moderation

This morning

Fitting a mean and regression with continuous data

Modelling Ordinal data Fitting the regression model with

ordinal data

Page 3: Means, Thresholds and Moderation

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

Page 4: Means, Thresholds and Moderation

Lets start with the data…

Page 5: Means, Thresholds and Moderation

If this was a pedigree data file…

Famid Ind Father Mother Zyg Sex Age Trait

2 1 0 0 0 1 x x

2 2 0 0 0 2 x x

2 3 1 2 MZ 1 18.12 91

2 4 1 2 MZ 1 18.12 95

Page 6: Means, Thresholds and Moderation

How can we make this data file?

Assume we have data with 3 variables:

Page 7: Means, Thresholds and Moderation

How do we make this data?

SPSSSORT CASES BY Family Individual .CASESTOVARS /ID = Family /INDEX = Individual /GROUPBY = VARIABLE .

SAS? R?

Page 8: Means, Thresholds and Moderation

Means…

In spss sas etc we calculate the mean

In Mx and other ML programs we estimate the mean

Page 9: Means, Thresholds and Moderation

Spss…

Page 10: Means, Thresholds and Moderation

Spss…

Page 11: Means, Thresholds and Moderation

Mx…

Means.mx

Page 12: Means, Thresholds and Moderation
Page 13: Means, Thresholds and Moderation

Spss assumes this is a sample

Mx assumes this is a population

Slightly different algebra

Page 14: Means, Thresholds and Moderation

How about regression?

Y=X*B +C

Regression speak AutismQuotient = Sex*Beta1 +

Age*Beta2 + Intercept BG speak

AutismQuotient = Sex Effect + Age Effect + Grand Mean

Page 15: Means, Thresholds and Moderation

Spss…

Page 16: Means, Thresholds and Moderation

regression.mx

Page 17: Means, Thresholds and Moderation

regression.mx

Page 18: Means, Thresholds and Moderation

regression.mx

Page 19: Means, Thresholds and Moderation

Spss…

Page 20: Means, Thresholds and Moderation

Coefficientsa

93.564 65.862 1.421 .157

.549 3.623 .011 .151 .880

-2.608 1.558 -.125 -1.673 .096

(Constant)

age1

sekse1

Model1

B Std. Error

UnstandardizedCoefficients

Beta

StandardizedCoefficients

t Sig.

Dependent Variable: AQ1a.

Page 21: Means, Thresholds and Moderation

Run regression.mx

Page 22: Means, Thresholds and Moderation

Coefficientsa

93.564 65.862 1.421 .157

.549 3.623 .011 .151 .880

-2.608 1.558 -.125 -1.673 .096

(Constant)

age1

sekse1

Model1

B Std. Error

UnstandardizedCoefficients

Beta

StandardizedCoefficients

t Sig.

Dependent Variable: AQ1a.

Page 23: Means, Thresholds and Moderation

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

Page 24: Means, Thresholds and Moderation

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

Page 25: Means, Thresholds and Moderation

How do we get the p-values?

Coefficientsa

93.564 65.862 1.421 .157

.549 3.623 .011 .151 .880

-2.608 1.558 -.125 -1.673 .096

(Constant)

age1

sekse1

Model1

B Std. Error

UnstandardizedCoefficients

Beta

StandardizedCoefficients

t Sig.

Dependent Variable: AQ1a.

Page 26: Means, Thresholds and Moderation

Set the elements to equal 0

Do this one at a time!

Page 27: Means, Thresholds and Moderation

So…Coefficientsa

93.564 65.862 1.421 .157

.549 3.623 .011 .151 .880

-2.608 1.558 -.125 -1.673 .096

(Constant)

age1

sekse1

Model1

B Std. Error

UnstandardizedCoefficients

Beta

StandardizedCoefficients

t Sig.

Dependent Variable: AQ1a.

Page 28: Means, Thresholds and Moderation

Why bother with Mx?

Because most stat packages can’t handle non-independent data…Non-independence reduces the

variance Biases t and F tests

Page 29: Means, Thresholds and Moderation

Why bother with Mx?

Because we want complete flexibility in the model specification…As you see later today

Page 30: Means, Thresholds and Moderation

Why bother with Mx?

Because very few packages can handle ordinal data adequately…

Page 31: Means, Thresholds and Moderation

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

Page 32: Means, Thresholds and Moderation

Twin 1 smoking initiation

twin1

822 47.5 53.0 53.0

730 42.2 47.0 100.0

1552 89.7 100.0

179 10.3

1731 100.0

0

1

Total

Valid

SystemMissing

Total

Frequency Percent Valid PercentCumulative

Percent

Page 33: Means, Thresholds and Moderation

Twin 1 smoking initiation

Page 34: Means, Thresholds and Moderation

Twin 1 smoking initiation

Page 35: Means, Thresholds and Moderation

Mean = .47

SD =.499

Non Smokers =53%

Page 36: Means, Thresholds and Moderation

Raw data distribution

Mean = .47

SD =.499

Non Smokers =53%

Threshold =.53

Standard normal distribution

Mean = 0

SD =1

Non Smokers =53%

Threshold =.074

Page 37: Means, Thresholds and Moderation

Threshold = .074 – Huh what?

How can I work this out Excell

=NORMSINV()

Page 38: Means, Thresholds and Moderation

Why do we rescale the data this way?

ConvenienceVariance always 1 Mean is always 0We can interpret the area under a

curve between two z-values as a probability or percentage

Page 39: Means, Thresholds and Moderation

Why do we rescale the data this way?

You could use other distributions but you would have to specify the fit function

Page 40: Means, Thresholds and Moderation

Threshold.mx

Page 41: Means, Thresholds and Moderation

Threshold = .075 – Huh what?

Page 42: Means, Thresholds and Moderation

How about age/sex correction?

Page 43: Means, Thresholds and Moderation

How about age/sex correction?

Page 44: Means, Thresholds and Moderation

What does this mean?

Age Beta = .007 For every 1 unit increase in Age the

threshold shifts .007

Page 45: Means, Thresholds and Moderation

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

Page 46: Means, Thresholds and Moderation

22 year olds

Threshold = .0422

38 year olds

Threshold =.1544

Is the age effect significant?

Page 47: Means, Thresholds and Moderation

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

Page 48: Means, Thresholds and Moderation

22 year olds

Threshold = .548

38 year olds

Threshold = 1.028

Is the age effect significant?

If Beta = .03

Page 49: Means, Thresholds and Moderation

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

Page 50: Means, Thresholds and Moderation

Female

Threshold =-.1118

Male

Threshold =-.1618

Are males or females more likely to smoke?

Page 51: Means, Thresholds and Moderation

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

Page 52: Means, Thresholds and Moderation

Mx Threshold Specification: 3+ Cat.

-3 31.20-1

2.2

Threshold matrix: T Full 2 2 Free

1st threshold

Twin 1 Twin 2

increment

Page 53: Means, Thresholds and Moderation

Mx Threshold Model: Thresholds L*T /

Threshold matrix: T Full 2 2 Free

1st threshold

Twin 1 Twin 2

increment

Mx Threshold Specification: 3+ Cat.

-3 31.20-1

2.2

Page 54: Means, Thresholds and Moderation

Mx Threshold Model: Thresholds L*T /

Threshold matrix: T Full 2 2 Free

1st threshold

Twin 1 Twin 2

increment

2nd threshold

Mx Threshold Specification: 3+ Cat.

-3 31.20-1

2.2

Page 55: Means, Thresholds and Moderation

Adding a regression

L*T + G@(D*B);

maxth =2, ndef=2, nsib=2, nthr=4

1 1 2G D B

1 1 2

sex sex sex

age age age

Page 56: Means, Thresholds and Moderation

Adding a regression

1 1 2G D B

1 1 2

sex sex sex

age age age

B*D =

* 1 * 1 * 2 * 2sex sex age age sex sex age age

G@(B*D) =

* 1 * 1 * 2 * 2

* 1 * 1 * 2 * 2

sex sex age age sex sex age age

sex sex age age sex sex age age

Page 57: Means, Thresholds and Moderation

Adding a regression

L*T + G@(B*D) =

11 * 1 * 1 12 * 2 * 2

( 11 21) * 1 * 1 ( 12 22) * 2 * 2

t sex sex age age t sex sex age age

t t sex sex age age t t sex sex age age

Page 58: Means, Thresholds and Moderation

Multivariate Threshold Models

Specification in Mx

Thanks Kate Morley for these slides

Page 59: Means, Thresholds and Moderation

#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 FemalesData NInput=8 Ordinal File=data.datLabelsfamID zyg covar_a covar_b var1_a var2_a var1_b var2_bSelect 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 pathsY Lower nvar nvar Free ! Common environmental pathsZ Lower nvar nvar Free ! Unique environmental pathsH Full 1 1T Full maxth nthr Free ! ThresholdsB Full nvar ndef Free ! Regression betasL lower maxth maxth ! For converting incremental to cumulative thresholdsG Full maxth 1 ! For duplicating regression betas across thresholdsK Full ndef nsib ! Contains definition variablesEND MATRICES;

Page 60: Means, Thresholds and Moderation

Threshold model for multivariate, multiplecategory 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

Page 61: Means, Thresholds and Moderation

Threshold correctionTwin 1Variable 1

Threshold correctionTwin 1Variable 2

Twin 1 Twin 2Definitionvariables

Threshold correctionTwin 2Variable 2

Threshold correctionTwin 2Variable 1

Page 62: Means, Thresholds and Moderation

Transpose:

Page 63: Means, Thresholds and Moderation
Page 64: Means, Thresholds and Moderation

Thresholds 1 & 2Twin 1Variable 1 Thresholds 1 & 2

Twin 1Variable 2

Thresholds 1 & 2Twin 2Variable 1

Thresholds 1 & 2Twin 2Variable 2

Page 65: Means, Thresholds and Moderation

=

Page 66: Means, Thresholds and Moderation

http://davidmlane.com/hyperstat/z_table.html