A
B
C
D
E
Multilevel and Longitudinal Modeling Using Stata
Fourth Edition
SOPHIA RABE-HESKETH
University of CaliforniaBerkeley
ANDERS SKRONDAL
Norwegian Institute of Public Health
University of Oslo
University of CaliforniaBerkeley
A Stata Press Publication
StataCorp LLC
College Station, Texas
Copyright 2005, 2008, 2012, 2022 by StataCorp LLC
All rights reserved. First edition 2005
Second edition 2008
Third edition 2012
Fourth edition 2022
Published by Stata Press, 4905 Lakeway Drive, College Station, Texas 77845
Typeset in L A T E X
Printed in the United States of America
Print ISBN-10: 1-59718-136-6 (volumes I and II)
Print ISBN-10: 1-59718-137-4 (volume I)
Print ISBN-10: 1-59718-138-2 (volume II)
Print ISBN-13: 978-1-59718-136-5 (volumes I and II)
Print ISBN-13: 978-1-59718-137-2 (volume I)
Print ISBN-13: 978-1-59718-138-9 (volume II)
ePub ISBN-10: 1-59718-309-1 (volumes I and II)
ePub ISBN-10: 1-59718-310-5 (volumes I)
ePub ISBN-10: 1-59718-311-3 (volumes II)
ePub ISBN-13: 978-1-59718-309-3 (volumes I and II)
ePub ISBN-13: 978-1-59718-310-9 (volumes I)
ePub ISBN-13: 978-1-59718-311-6 (volumes II)
Mobi ISBN-10: 1-59718-312-1 (volumes I and II)
Mobi ISBN-10: 1-59718-313-X (volumes I)
Mobi ISBN-10: 1-59718-314-8 (volumes II)
Mobi ISBN-13: 978-1-59718-312-3 (volumes I and II)
Mobi ISBN-13: 978-1-59718-313-0 (volumes I)
Mobi ISBN-13: 978-1-59718-314-7 (volumes II)
Library of Congress Control Number: 2021944297
No part of this book may be reproduced, stored in a retrieval system, or transcribed, in any form or by any meanselectronic, mechanical, photocopy, recording, or otherwisewithout the prior written permission of StataCorp LLC.
Stata, , Stata Press, Mata, , and NetCourse are registered trademarks of StataCorp LLC.
Stata and Stata Press are registered trademarks with the World Intellectual Property Organization of the United Nations.
NetCourseNow is a trademark of StataCorp LLC.
L A T E X is a trademark of the American Mathematical Society.
Other brand and product names are registered trademarks or trademarks of their respective companies.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.3.3
9.3.4
9.4
9.5
9.6
9.6.1
9.6.2
9.6.3
9.7
9.7.1
9.7.2
9.7.3
9.7.4
9.7.5
9.8
9.9
9.10
A
10.1
10.2
10.2.1
10.2.2
10.3
10.4
10.5
10.6
10.6.1
10.6.2
10.6.3
10.7
10.8
10.8.1
10.8.2
10.8.3
10.9
10.9.1
10.9.2
10.10
10.10.1
10.10.2
10.11
10.11.1
10.11.2
10.11.3
10.12
10.12.1
10.12.2
10.13
10.13.1
10.13.2
10.14
10.15
11.1
11.2
11.2.1
11.2.2
11.2.3
11.2.4
11.3
11.3.1
11.3.2
11.3.3
11.4
11.4.1
11.5
11.5.1
11.5.2
11.6
11.6.1
11.7
11.7.1
11.7.2
11.8
11.9
11.9.1
11.10
11.10.1
11.11
11.11.1
11.12
11.13
11.14
12.1
12.2
12.2.1
12.2.2
12.2.3
12.3
12.4
12.5
12.6
12.6.1
12.7
12.7.1
12.7.2
12.7.3
12.8
12.9
12.10
12.11
13.1
13.2
13.2.1
13.2.2
13.3
13.4
13.5
13.6
13.6.1
13.7
13.7.1
13.7.2
13.7.3
13.8
13.8.1
13.9
13.9.1
13.9.2
13.9.3
13.10
13.10.1
13.10.2
13.10.3
13.10.4
13.11
13.11.1
13.11.2
13.11.3
13.12
13.13
13.14
13.15
13.15.1
13.15.2
13.16
13.16.1
13.16.2
13.17
13.18
14.1
14.2
14.2.1
14.2.2
14.2.3
14.2.4
14.2.5
14.2.6
14.2.7
14.3
14.4
14.5
14.6
14.6.1
14.6.2
14.7
14.7.1
14.8
14.9
14.10
15.1
15.2
15.3
15.4
15.4.1
15.4.2
15.4.3
15.4.4
15.5
15.5.1
15.6
15.7
15.8
15.8.1
15.8.2
15.8.3
15.9
15.9.1
15.9.2
15.9.3
15.10
15.10.1
15.10.2
15.10.3
15.11
15.11.1
15.12
15.12.1
15.12.2
15.12.3
15.13
15.14
16.1
16.2
16.3
16.3.1
16.3.2
16.3.3
16.3.4
16.4
16.4.1
16.5
16.5.1
16.5.2
16.6
16.6.1
16.6.2
16.6.3
16.7
16.8
16.8.1
16.8.2
16.8.3
16.8.4
16.8.5
16.9
16.10
B
C
D
E
Tables
1.1
1.2
2.1
2.2
2.3
2.4
3.1
3.2
3.3
4.1
III.1
5.1
5.2
5.3
5.4
5.5
5.6
6.1
6.2
6.3
6.4
7.1
7.2
7.3
8.1
8.2
9.1
9.2
9.3
9.4
9.5
9.6
10.1
10.2
10.3
11.1
11.2
12.1
12.2
13.1
13.2
13.3
13.4
13.5
14.1
14.2
14.3
15.1
15.2
15.3
15.4
15.5
15.6
15.7
15.8
16.1
16.2
16.3
16.4
Figures
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
1.10
1.11
1.12
1.13
1.14
1.15
1.16
1.17
1.18
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
4.15
III.1
III.2
III.3
III.4
5.1
5.2