├── .Rbuildignore ├── .gitattributes ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── R ├── plot_regsim_method.R ├── print_regsim_method.R └── regsim_function.R ├── build_package.R ├── man ├── plot.regsim.Rd ├── print.regsim.Rd └── regsim.Rd ├── readme.Rmd ├── readme.html ├── readme.md ├── readme_cache ├── latex │ ├── unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.RData │ ├── unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.rdb │ ├── unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.rdx │ ├── unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.RData │ ├── unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.rdb │ ├── unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.rdx │ ├── unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.RData │ ├── unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.rdb │ ├── unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.rdx │ ├── unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.RData │ ├── unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.rdb │ ├── unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.rdx │ ├── unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.RData │ ├── unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.rdb │ ├── unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.rdx │ ├── unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.RData │ ├── unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.rdb │ ├── unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.rdx │ ├── unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.RData │ ├── unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.rdb │ ├── unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.rdx │ ├── unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.RData │ ├── unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.rdb │ ├── unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.rdx │ ├── unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.RData │ ├── unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.rdb │ ├── unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.rdx │ ├── unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.RData │ ├── unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.rdb │ └── unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.rdx └── markdown_github │ ├── unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.RData │ ├── unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.rdb │ ├── unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.rdx │ ├── unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.RData │ ├── unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.rdb │ ├── unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.rdx │ ├── unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.RData │ ├── unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.rdb │ ├── unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.rdx │ ├── unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.RData │ ├── unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.rdb │ ├── unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.rdx │ ├── unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.RData │ ├── unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.rdb │ ├── unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.rdx │ ├── unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.RData │ ├── unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.rdb │ ├── unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.rdx │ ├── unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.RData │ ├── unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.rdb │ ├── unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.rdx │ ├── unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.RData │ ├── unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.rdb │ └── unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.rdx ├── readme_files ├── figure-html │ ├── unnamed-chunk-13-1.png │ ├── unnamed-chunk-14-1.png │ ├── unnamed-chunk-17-1.png │ ├── unnamed-chunk-18-1.png │ └── unnamed-chunk-5-1.png ├── figure-latex │ ├── unnamed-chunk-12-1.pdf │ ├── unnamed-chunk-15-1.pdf │ ├── unnamed-chunk-18-1.pdf │ ├── unnamed-chunk-20-1.pdf │ ├── unnamed-chunk-23-1.pdf │ ├── unnamed-chunk-25-1.pdf │ ├── unnamed-chunk-26-1.pdf │ ├── unnamed-chunk-27-1.pdf │ ├── unnamed-chunk-30-1.pdf │ ├── unnamed-chunk-31-1.pdf │ ├── unnamed-chunk-34-1.pdf │ └── unnamed-chunk-4-1.pdf └── figure-markdown_github │ ├── unnamed-chunk-12-1.png │ ├── unnamed-chunk-13-1.png │ ├── unnamed-chunk-14-1.png │ ├── unnamed-chunk-15-1.png │ ├── unnamed-chunk-16-1.png │ ├── unnamed-chunk-17-1.png │ ├── unnamed-chunk-18-1.png │ ├── unnamed-chunk-19-1.png │ ├── unnamed-chunk-20-1.png │ ├── unnamed-chunk-21-1.png │ ├── unnamed-chunk-23-1.png │ ├── unnamed-chunk-24-1.png │ ├── unnamed-chunk-25-1.png │ ├── unnamed-chunk-26-1.png │ ├── unnamed-chunk-27-1.png │ ├── unnamed-chunk-28-1.png │ ├── unnamed-chunk-29-1.png │ ├── unnamed-chunk-30-1.png │ ├── unnamed-chunk-31-1.png │ ├── unnamed-chunk-33-1.png │ ├── unnamed-chunk-33-2.png │ ├── unnamed-chunk-33-3.png │ ├── unnamed-chunk-34-1.png │ ├── unnamed-chunk-4-1.png │ └── unnamed-chunk-5-1.png └── tex ├── 54d3f605f8dfd1bab89b71be61ea281c.svg ├── 6192455f11190d8ed1eb8b18d3b6f8de.svg ├── d6e0590a9f11ecf55f14839f97e6232d.svg └── de5d740af3fd4679ffc5d10a6e891286.svg /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | readme_cache 4 | readme_files 5 | readme.html 6 | readme.md 7 | readme.pdf 8 | readme.Rmd 9 | readme.Rproj 10 | build_package.R 11 | tex 12 | vignette_cache 13 | vignette_files 14 | vignette.html 15 | vignette.Rmd 16 | .git 17 | .gitattributes 18 | .gitignore 19 | .RData 20 | .RHistory 21 | .Rproj.user -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: regsim 2 | Title: Fit and Appraise Regression Models Using Simulated Data 3 | Version: 0.1.4 4 | Authors@R: 5 | person(given = "Matthew", 6 | family = "McBee", 7 | role = c("aut", "cre"), 8 | email = "mcbeem@etsu.edu") 9 | Description: This package provides a quick and convenient means for simulating data from a path diagram, fitting regression models to the simulated data, and appraising the model's performance with respect to a particular target parameter and its standard error. The function calculates the bias, coverage rate, RMSE, and analytical and empirical standard errors. 10 | License: GPL-3 11 | Imports: lavaan, semPlot, dagitty, psych 12 | Encoding: UTF-8 13 | LazyData: true 14 | RoxygenNote: 6.1.1 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(plot,regsim) 4 | S3method(print,regsim) 5 | export(regsim) 6 | importFrom(graphics,abline) 7 | importFrom(graphics,hist) 8 | importFrom(graphics,legend) 9 | importFrom(graphics,plot) 10 | importFrom(graphics,points) 11 | importFrom(lavaan,simulateData) 12 | importFrom(semPlot,semPaths) 13 | importFrom(semPlot,semPlotModel) 14 | importFrom(stats,as.formula) 15 | importFrom(stats,confint) 16 | importFrom(stats,density) 17 | importFrom(stats,dnorm) 18 | importFrom(stats,lm) 19 | importFrom(stats,na.omit) 20 | importFrom(stats,quantile) 21 | importFrom(stats,sd) 22 | -------------------------------------------------------------------------------- /R/plot_regsim_method.R: -------------------------------------------------------------------------------- 1 | #' Plot method for class regsim 2 | #' 3 | #' @param x an object of class regsim to be printed 4 | #' @param type character; one of "model", "perf", or "data". the type of plot to produce. 5 | #' defaults to "model" 6 | #' @param sizeMan numeric; controls scale of the variables and boxes, defaults to 10. Applies only to \code{type="model"}. 7 | #' @param edge.label.cex numeric; controls scale of the path coefficient. defaults to 1.5. Applies only to \code{type="model"}. 8 | #' @param fixedStyle numeric or vector of an lty and a color for the arrows. defaults to 1 for black, solid lines. Applies only to \code{type="model"}. 9 | #' @param nCharNodes numeric; controls how many characters of each variable's name to display. defaults to 10 | #' zero so that the full name is shown. Applies only to \code{type="model"}. 11 | #' @param whatLabels character, controls what labels are shown in the model diagram. Must be one of \code{"name"}, 12 | #' \code{"est"}, \code{"stand"}, \code{"eq"}, or \code{"no"}. Defaults to \code{"est"}. Applies only to \code{type="model"}. 13 | #' @param residuals logical, controls whether the residuals should be displayed in the model plot. 14 | #' Applies only to \code{type="model"}. 15 | #' @param ... additional arguments to be passed to \code{semPlot::semPaths} (for \code{type="model"}), 16 | #' \code{hist} (for \code{type="perf"}), or to \code{psych::pairs.panels} (for \code{type="data"}) 17 | #' 18 | #' @importFrom semPlot semPlotModel semPaths 19 | #' @export 20 | 21 | plot.regsim <- function(x, type="perf", sizeMan=10, edge.label.cex=1.5, 22 | fixedStyle=1, nCharNodes=0, whatLabels="est", residuals=FALSE, ...) { 23 | 24 | if (max(!type %in% c("model", "perf", "data", "compareSE"))) stop("Argument type must only contain \"model\", \"perf\", \"data\", or \"compareSE\"") 25 | 26 | if (max(type %in% "model")) { 27 | semPlot::semPaths(semPlot::semPlotModel(x$true.model), whatLabels=whatLabels, 28 | exoCov=FALSE, sizeMan=sizeMan, sizeLat=sizeMan, edge.label.cex=edge.label.cex, residuals=residuals, 29 | fixedStyle=fixedStyle, nCharNodes=nCharNodes, ...)} 30 | 31 | if (max(type %in% "perf")) { 32 | lower.limit <- min(x$targetval, x$b) 33 | upper.limit <- max(x$targetval, x$b) 34 | hist(x$b, freq=FALSE, xlab="Estimates", main="", 35 | xlim=c(lower.limit, upper.limit), ...) 36 | points(density(x$b), type='l') 37 | abline(v=x$targetval, col="red", lty="dashed", lwd=2) 38 | abline(v=x$empirical.CI, lty="dotted") 39 | } 40 | 41 | if (max(type %in% "data")) { 42 | psych::pairs.panels(x$data, ...) 43 | } 44 | 45 | if (max(type %in% "compareSE")) { 46 | lower.limit <- min(x$targetval, x$b) 47 | upper.limit <- max(x$targetval, x$b) 48 | 49 | xvals <- seq(lower.limit, upper.limit, length.out=1000) 50 | yvals <- dnorm(xvals, mean=x$expected.b, sd=x$analytic.SE) 51 | dens <- density(x$b) 52 | plot(dens, ylim=c(0, max(dens$y, yvals)+.25*abs(max(dens$y, yvals))), 53 | xlab="Estimates", main="") 54 | points(xvals, yvals, type="l", lty="dotted", col="blue") 55 | abline(v=x$targetval, col="red", lty="dashed") 56 | legend("topright", legend=c("Empirical", "Analytic"), 57 | col=c("black", "blue"), lty=c("solid", "dashed"), cex=0.85) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /R/print_regsim_method.R: -------------------------------------------------------------------------------- 1 | #' Print method for class regsim 2 | #' 3 | #' @param x an object of class regsim to be printed 4 | #' @param ... additional arguments to be passed to \code{print} 5 | #' 6 | #' @export 7 | 8 | print.regsim <- function (x, ...) { 9 | hid <- attr(x, "hidden") 10 | print(x[!names(x) %in% hid], ...) 11 | } 12 | -------------------------------------------------------------------------------- /R/regsim_function.R: -------------------------------------------------------------------------------- 1 | #' Fit and appraise regression models using simulated data 2 | #' 3 | #' This function provides a quick and convenient means for simulating data from a 4 | #' path diagram or SEM, fitting a regression model to the simulated data, and appraising the 5 | #' model's performance with respect to a particular target parameter and its standard 6 | #' error. The function calculates the bias, coverage rate, RMSE, and analytical and empirical 7 | #' standard errors. 8 | #' 9 | #' @param reps the number of repetitions to perform 10 | #' @param n the sample size of the generated data 11 | #' @param true.model character; the population model used to generate the data specified in \code{lavaan} syntax. See example. 12 | #' @param fit.model character; the model to the fitted to the data in \code{lm()} model formula syntax 13 | #' @param targetparm character; the focal predictor. Must be included in the model formula passed to \code{true.model} 14 | #' @param targetval the true value of the path coefficient relating the focal predictor to the response variable 15 | #' @param interval the confidence interval width, defaults to 0.95. 16 | #' @param standardized logical; should the data be generated on a standardized scale? defaults to FALSE 17 | #' @param ... additional arguments passed to lavaan's \code{simulateData} function. For example, one could invoke the 18 | #' \code{kurtosis} or \code{skewness} arguments to generate non-normal data 19 | #' 20 | #' @return A list containing the following: 21 | #' \item{true.model}{the true model from which data are simulated} 22 | #' \item{fit.model}{the regression model that is fit to the data} 23 | #' \item{b}{a vector of target parameter estimates across the repetitions} 24 | #' \item{data}{a data frame containing the simulated data from the first repetition} 25 | #' \item{true.DAG}{the true.model expressed as an object of class dagitty} 26 | #' \item{targetval}{the true value of the target parameter, used to calculate bias, RMSE, and coverage} 27 | #' \item{expected.b}{the mean value of the target parameter across the repetitions} 28 | #' \item{bias}{the mean difference between the estimated and target values of the parameter across repetitions} 29 | #' \item{analytic.SE}{the mean of the analytic standard errors across repetitions} 30 | #' \item{empirical.SE}{the standard deviation of the parameter estimates} 31 | #' \item{analytic.CI}{the analytic confidence interval boundaries, calculated as the mean of the lower and upper boundaries across the repetitions} 32 | #' \item{empirical.CI}{the empirical confidence interval boundaries across the repetitions} 33 | #' \item{coverage}{the proportion of repetitions in which the confidence interval captured 34 | #' the specified target value of the parameter. This should appoximately equal 35 | #' the specified confidence level} 36 | #' \item{RMSE}{the root mean squared error} 37 | #' \item{adjustment.sets}{the sets of covariates that must be included in the fitted model 38 | #' to yield an unbiased and consistent estimate of the effect of the target parameter on the 39 | #' response variable in fit.model} 40 | #' 41 | #' @examples 42 | #' 43 | #' # this is a DAG where Z is a confounder of the X -> Y relationship 44 | #' true.model <- 'X ~ .5*Z 45 | #' Y ~ .5*X + .5*Z' 46 | #' 47 | #' # misspecified model omitting Z 48 | #' fit.model <- 'Y ~ X' 49 | #' 50 | #' result <- regsim(reps=1000, n=100, true.model, fit.model, targetparm="X", 51 | #' targetval=.5) 52 | #' result 53 | #' 54 | #' # visualize the model 55 | #' plot(result, type="model") 56 | #' # visualize the simulated data 57 | #' plot(result, type="data") 58 | #' # visualize the results 59 | #' plot(result, type="perf") 60 | #' plot(result, type="compareSE") 61 | #' 62 | #' @importFrom stats as.formula confint lm na.omit sd quantile density dnorm 63 | #' @importFrom lavaan simulateData 64 | #' @importFrom graphics abline hist legend plot points 65 | #' @export 66 | 67 | regsim <- function(reps, n, true.model, fit.model, targetparm, targetval, 68 | interval=.95, standardized=FALSE, ...) { 69 | 70 | # begin checks of the supplied arguments 71 | # check whether reps, n, and interval are numeric 72 | if (!is.numeric(n)) stop("n must be a number") 73 | if (!is.numeric(reps)) stop("reps must be a number") 74 | if (!is.numeric(interval)) stop("reps must be a number") 75 | 76 | # check whether standardized is logical 77 | if (!is.logical(standardized)) stop("standardized must be TRUE or FALSE") 78 | 79 | # check whether reps > 2 80 | if (reps < 2) stop("reps must be at least 2, and should be at least 1000 for trustworthy results") 81 | if (reps < 1000) warning("reps should be at least 1000 for trustworthy results") 82 | 83 | # check whether interval is a proportion 84 | if (0 > interval | interval > 1) stop("interval must be a proportion") 85 | 86 | # check if n is too small given fit.model 87 | if (n < length(all.vars(as.formula(fit.model)))+1) stop("insufficient df to estimate model; increase n") 88 | 89 | #check whether targetparm is a character 90 | if (is.character(targetparm) != TRUE) stop("The targetparm argument must be a quoted variable name") 91 | 92 | #check whether the targetparm is included in the fit.model and true.model 93 | if (!targetparm %in% all.vars(as.formula(fit.model))) stop("The target parameter must be included in fit.model") 94 | if (!grepl(targetparm, true.model, fixed=TRUE)) stop("The target parameter must be included in true.model") 95 | 96 | #check whether fit.model is a subset of true.model 97 | if (min(all.vars(as.formula(fit.model)) %in% unique(na.omit(unlist(strsplit(unlist(true.model), "[^a-zA-Z_.-]+")))))==0) stop("All variables in fit.model must be included in true.model") 98 | # end argument checks 99 | 100 | # find position of target parameter in model formula. 101 | parmnumber <- which(all.vars(as.formula(fit.model))==targetparm) 102 | 103 | # generate data using lavaan 104 | # note that it is one huge dataset. this is much faster 105 | myData <- lavaan::simulateData(true.model, sample.nobs=n*reps, 106 | standardized=standardized, ...) 107 | 108 | # define empty objects to hold results 109 | coverage <- rep(NA, times=reps) 110 | bias <- rep(NA, times=reps) 111 | b <- rep(NA, times=reps) 112 | se <- rep(NA, times=reps) 113 | reg <- list(length=reps) 114 | CI <- matrix(c(NA, NA), nrow=reps, ncol=2) 115 | 116 | # loop over reps 117 | for (i in 1:reps) { 118 | # indexes subsets of myData for each rep 119 | reg[[i]] <- lm(fit.model, data=myData[(1+(i-1)*n):(i*n),]) 120 | # b is the target parameter estimate 121 | b[i] <- reg[[i]]$coef[parmnumber] 122 | # se is the analytical standard error of the target estimate 123 | se[i] <- summary(reg[[i]])$coef[parmnumber, 2] 124 | # CI will contain the boundaries of the CI 125 | CI[i,] <- confint(reg[[i]], parm=parmnumber, level=interval) 126 | # coverage is a logical vector indicating whether true value was captured 127 | coverage[i] <- CI[i, 1] <= targetval & CI[i, 2] >= targetval 128 | # bias is the true value minus the estimate 129 | bias[i] <- reg[[i]]$coef[parmnumber] - targetval 130 | } 131 | 132 | true.DAG <- dagitty::lavaanToGraph(lavaan::lavaanify(true.model)) 133 | dagitty::exposures(true.DAG) <- targetparm 134 | dagitty::outcomes(true.DAG) <- all.vars(as.formula(fit.model))[1] 135 | 136 | analytic.CI <- c(mean(CI[,1]), mean(CI[,2])) 137 | names(analytic.CI) <- c(paste0((1-interval)/2*100, "%"), paste0((1-((1-interval)/2))*100, "%")) 138 | 139 | output <- list(true.model=true.model, 140 | fit.model=fit.model, 141 | b=b, 142 | data=myData[1:n,], 143 | true.DAG = true.DAG, 144 | targetval=targetval, 145 | expected.b=mean(b), 146 | bias=mean(bias), 147 | analytic.SE=mean(se), 148 | empirical.SE=sd(b), 149 | analytic.CI=analytic.CI, 150 | empirical.CI=quantile(b, c((1-interval)/2, 1-((1-interval)/2))), 151 | coverage=mean(coverage), 152 | RMSE = sqrt(mean(bias^2)), 153 | adjustment.sets = dagitty::adjustmentSets(true.DAG)) 154 | 155 | class(output) = c("regsim", "list") 156 | attr(output, "hidden") <- c("data", "b", "true.model", "fit.model", "true.DAG") 157 | 158 | 159 | # calculate the summary results 160 | return(output) 161 | } 162 | -------------------------------------------------------------------------------- /build_package.R: -------------------------------------------------------------------------------- 1 | library(devtools) 2 | library(roxygen2) 3 | 4 | #/Users/matt/OneDrive/regsim 5 | setwd("/Users/matt/OneDrive/") 6 | # initialze and create package 7 | #usethis::create_package("regsim") 8 | 9 | setwd("/Users/matt/OneDrive/regsim") 10 | document() 11 | setwd("..") 12 | install("regsim") 13 | library(regsim) 14 | 15 | setwd("/Users/matt/OneDrive/regsim") 16 | check() 17 | 18 | # library(devtools) 19 | # library(roxygen2) 20 | # library(testthat) 21 | # 22 | # setwd("/Users/matt/OneDrive/giftedCalcs") 23 | # document() 24 | # 25 | # setwd("..") 26 | # install("giftedCalcs") 27 | # 28 | # setwd("/Users/matt/OneDrive/giftedCalcs") 29 | # check() 30 | # devtools::test() 31 | # 32 | # test(filter="var_mean") 33 | # test(filter="r_identified") 34 | # test(filter="d_identified") 35 | # test(filter="d_identified_v") 36 | # test(filter="q_identified") 37 | # test(filter="p_identified") 38 | # test(filter="mean_identified") 39 | # test(filter="sd_identified") 40 | # test(filter="marginal_psychometrics") 41 | # test(filter="conditional_moments") 42 | # test(filter="conditional_p_id") 43 | # test(filter="estimate_valid") 44 | # test(filter="boot_estimate_valid") 45 | # test(filter="estimate_performance") 46 | # 47 | # 48 | # 49 | # 50 | # 51 | # 52 | # 53 | # 54 | # 55 | # 56 | # setwd("..") 57 | # install("giftedCalcs") 58 | # 59 | # 60 | # detach("package:giftedCalcs", unload=T) 61 | # remove.packages("giftedCalcs") 62 | # 63 | # devtools::install_github("mcbeem/giftedCalcs", force=T) 64 | # library(giftedCalcs) 65 | # help(package="giftedCalcs") 66 | 67 | -------------------------------------------------------------------------------- /man/plot.regsim.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_regsim_method.R 3 | \name{plot.regsim} 4 | \alias{plot.regsim} 5 | \title{Plot method for class regsim} 6 | \usage{ 7 | \method{plot}{regsim}(x, type = "perf", sizeMan = 10, 8 | edge.label.cex = 1.5, fixedStyle = 1, nCharNodes = 0, 9 | whatLabels = "est", residuals = FALSE, ...) 10 | } 11 | \arguments{ 12 | \item{x}{an object of class regsim to be printed} 13 | 14 | \item{type}{character; one of "model", "perf", or "data". the type of plot to produce. 15 | defaults to "model"} 16 | 17 | \item{sizeMan}{numeric; controls scale of the variables and boxes, defaults to 10. Applies only to \code{type="model"}.} 18 | 19 | \item{edge.label.cex}{numeric; controls scale of the path coefficient. defaults to 1.5. Applies only to \code{type="model"}.} 20 | 21 | \item{fixedStyle}{numeric or vector of an lty and a color for the arrows. defaults to 1 for black, solid lines. Applies only to \code{type="model"}.} 22 | 23 | \item{nCharNodes}{numeric; controls how many characters of each variable's name to display. defaults to 24 | zero so that the full name is shown. Applies only to \code{type="model"}.} 25 | 26 | \item{whatLabels}{character, controls what labels are shown in the model diagram. Must be one of \code{"name"}, 27 | \code{"est"}, \code{"stand"}, \code{"eq"}, or \code{"no"}. Defaults to \code{"est"}. Applies only to \code{type="model"}.} 28 | 29 | \item{residuals}{logical, controls whether the residuals should be displayed in the model plot. 30 | Applies only to \code{type="model"}.} 31 | 32 | \item{...}{additional arguments to be passed to \code{semPlot::semPaths} (for \code{type="model"}), 33 | \code{hist} (for \code{type="perf"}), or to \code{psych::pairs.panels} (for \code{type="data"})} 34 | } 35 | \description{ 36 | Plot method for class regsim 37 | } 38 | -------------------------------------------------------------------------------- /man/print.regsim.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print_regsim_method.R 3 | \name{print.regsim} 4 | \alias{print.regsim} 5 | \title{Print method for class regsim} 6 | \usage{ 7 | \method{print}{regsim}(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{an object of class regsim to be printed} 11 | 12 | \item{...}{additional arguments to be passed to \code{print}} 13 | } 14 | \description{ 15 | Print method for class regsim 16 | } 17 | -------------------------------------------------------------------------------- /man/regsim.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/regsim_function.R 3 | \name{regsim} 4 | \alias{regsim} 5 | \title{Fit and appraise regression models using simulated data} 6 | \usage{ 7 | regsim(reps, n, true.model, fit.model, targetparm, targetval, 8 | interval = 0.95, standardized = FALSE, ...) 9 | } 10 | \arguments{ 11 | \item{reps}{the number of repetitions to perform} 12 | 13 | \item{n}{the sample size of the generated data} 14 | 15 | \item{true.model}{character; the population model used to generate the data specified in \code{lavaan} syntax. See example.} 16 | 17 | \item{fit.model}{character; the model to the fitted to the data in \code{lm()} model formula syntax} 18 | 19 | \item{targetparm}{character; the focal predictor. Must be included in the model formula passed to \code{true.model}} 20 | 21 | \item{targetval}{the true value of the path coefficient relating the focal predictor to the response variable} 22 | 23 | \item{interval}{the confidence interval width, defaults to 0.95.} 24 | 25 | \item{standardized}{logical; should the data be generated on a standardized scale? defaults to FALSE} 26 | 27 | \item{...}{additional arguments passed to lavaan's \code{simulateData} function. For example, one could invoke the 28 | \code{kurtosis} or \code{skewness} arguments to generate non-normal data} 29 | } 30 | \value{ 31 | A list containing the following: 32 | \item{true.model}{the true model from which data are simulated} 33 | \item{fit.model}{the regression model that is fit to the data} 34 | \item{b}{a vector of target parameter estimates across the repetitions} 35 | \item{data}{a data frame containing the simulated data from the first repetition} 36 | \item{true.DAG}{the true.model expressed as an object of class dagitty} 37 | \item{targetval}{the true value of the target parameter, used to calculate bias, RMSE, and coverage} 38 | \item{expected.b}{the mean value of the target parameter across the repetitions} 39 | \item{bias}{the mean difference between the estimated and target values of the parameter across repetitions} 40 | \item{analytic.SE}{the mean of the analytic standard errors across repetitions} 41 | \item{empirical.SE}{the standard deviation of the parameter estimates} 42 | \item{analytic.CI}{the analytic confidence interval boundaries, calculated as the mean of the lower and upper boundaries across the repetitions} 43 | \item{empirical.CI}{the empirical confidence interval boundaries across the repetitions} 44 | \item{coverage}{the proportion of repetitions in which the confidence interval captured 45 | the specified target value of the parameter. This should appoximately equal 46 | the specified confidence level} 47 | \item{RMSE}{the root mean squared error} 48 | \item{adjustment.sets}{the sets of covariates that must be included in the fitted model 49 | to yield an unbiased and consistent estimate of the effect of the target parameter on the 50 | response variable in fit.model} 51 | } 52 | \description{ 53 | This function provides a quick and convenient means for simulating data from a 54 | path diagram or SEM, fitting a regression model to the simulated data, and appraising the 55 | model's performance with respect to a particular target parameter and its standard 56 | error. The function calculates the bias, coverage rate, RMSE, and analytical and empirical 57 | standard errors. 58 | } 59 | \examples{ 60 | 61 | # this is a DAG where Z is a confounder of the X -> Y relationship 62 | true.model <- 'X ~ .5*Z 63 | Y ~ .5*X + .5*Z' 64 | 65 | # misspecified model omitting Z 66 | fit.model <- 'Y ~ X' 67 | 68 | result <- regsim(reps=1000, n=100, true.model, fit.model, targetparm="X", 69 | targetval=.5) 70 | result 71 | 72 | # visualize the model 73 | plot(result, type="model") 74 | # visualize the simulated data 75 | plot(result, type="data") 76 | # visualize the results 77 | plot(result, type="perf") 78 | plot(result, type="compareSE") 79 | 80 | } 81 | -------------------------------------------------------------------------------- /readme.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction to the regsim R package" 3 | output: 4 | md_document: 5 | variant: markdown_github 6 | --- 7 | 8 | ```{r, echo=F, eval=F} 9 | output: 10 | md_document: 11 | variant: markdown_github 12 | ``` 13 | 14 | ```{r, include=FALSE} 15 | library(regsim) 16 | library(dagitty) 17 | ``` 18 | 19 | ```regsim``` is an ```R``` package to make simulation quick and easy. It can be installed from github with the following ```R``` code. 20 | 21 | ```{r, eval=F} 22 | # the following two lines need only to be run once 23 | install.packages("devtools") 24 | devtools::install_github("mcbeem/regsim") 25 | 26 | # add regsim's functions to R namespace so they can be used 27 | library(regsim) 28 | ``` 29 | 30 | # Example 1: Confounders and mediators 31 | 32 | A researcher envisions the following true data-generating process: 33 | 34 | ```{r, fig.width=4.5, fig.height=2.5, echo=F} 35 | dag <- dagitty("dag{Y <- A -> X -> M -> Y; Y <- B -> X; }") 36 | coordinates(dag) <- list(x=c(A=.5, B=1.5, X=0, Y=2, M=1), 37 | y=c(A=0, B=0, X=1, Y=1, M=1)) 38 | exposures(dag) <- "X" 39 | outcomes(dag) <- "Y" 40 | plot(dag) 41 | ``` 42 | 43 | And is interested in estimating the effect of $X$ on $Y$ using a linear regression model of the following form: 44 | 45 | $Y_i = b_0 + b_1(X_i) + ... + e_i$ 46 | 47 | where $...$ potentially contains the effect of a set of *covariates* or *adjustment variables*. In this case, those covariates could include any combination of $A$, $B$, or $M$. What are the consequences of different choices? 48 | Simulation is a useful technique for exploring the results of analytic decisions. One reason it is so useful is that the true model, and the correct effect of $X \rightarrow Y$, is known. Thus, the estimates produced by linear regression can be compared to the known, true values. 49 | 50 | ## Defining the Data Generating (True) Model 51 | 52 | The process of specifying the data generating model is simple. 53 | 54 | 1. **Sketch the path diagram (or SEM) describing the true model**. The process begins by sketching out a path diagram of the relationships between the variables. The arrows indicate not only causation, but in this case also imply a linear functional form. Each arrow must be assigned a *path coefficient*; a regression slope describing how much the downstream variable will change in response to an isolated-one unit change of the upstream variable. 55 | 56 | 2. **Classify the variables**. Next, the variables in the diagram are classified as either **exogenous** or **endogenous**. An exogenous variable has no arrow directed towards it; it has no in-system causes. An endogenous variable has at least one arrow directed toward it. In our example, variables $A$ and $B$ are exogenous, while $X$, $M$, and $Y$ are endogenous. 57 | 58 | 3. **Write models for the endogenous variables**. Each exogenous variable must be described in terms of its causes. The syntax is similar to ```R```'s model formula used in ```lm()``` and many other model-fitting routines. In our example path diagram, $X$, $M$, and $Y$ were endogenous, so a model for each one will need to be provided. 59 | 60 | Let's begin by examining $X$, which is caused by $A$ and $B$ according to our diagram. In ```R```'s formula syntax, we would write: 61 | 62 | ```{r, eval=FALSE} 63 | X ~ A + B 64 | ``` 65 | 66 | Where the ```~``` character is read "predicted by" or "regressed on." This formula corresponds to a regression model of the form: 67 | 68 | $$X_i = b_0 + b_1(A_i) + b_2(B_i) + e_i$$ 69 | 70 | Since we are specifying the true model, we must provide values for parameters $b_1$ and $b_2$. The intercept, $b_0$, and the residual variance $e_i$ are nuisance parameters in many simulation applications. We do not need to choose values for them when using ```regsim()``` to simulate data. The ```regsim()``` function uses the ```simulateSEM()``` function from the ```lavaan``` package to do the data generation. 71 | 72 | Let's choose values of 0.5 for both $b_1$ and $b_2$. The model for $X$, expressed in the proper syntax for ```regsim()```, is as follows. 73 | 74 | ```{r, eval=FALSE} 75 | X ~ .5*A + .5*B 76 | ``` 77 | 78 | We must do the same for the endogenous variables $M$ and $Y$. Variable $M$ has only one arrow pointing to it, so its model has only one predictor variable, $X$. Choosing 0.5 as the path coefficient for $X \rightarrow M$, $M$'s model is written: 79 | 80 | ```{r, eval=FALSE} 81 | M ~ .5*X 82 | ``` 83 | 84 | Finally, $Y$ is caused by $A$, $B$, and $M$, so its model must include these variables. Sticking with 0.5 as our arbitrary value for all the path coefficients, the model for $Y$ is written: 85 | 86 | ```{r, eval=FALSE} 87 | Y ~ .5*A + .5*B + .5*M 88 | ``` 89 | 90 | We will create an object called ```true.model``` that will be passed to ```regsim()``` to describe the model. It will consist of a quoted string including all three of the models specified above. These must be separated with line breaks. The full ```lavaan``` syntax is available for data generation, including latent variables. 91 | 92 | ```{r} 93 | true.model <- "X ~ .5*A + .5*B 94 | M ~ .5*X 95 | Y ~ .5*M + .5*A + .5*B" 96 | ``` 97 | 98 | By default, ```regsim()``` will sample the exogenous as well as the residuals for the endogenous variables from independent normal distributions. You can alter the distribution, to some extent, via the optional ```kurtosis=``` and ```skewness=``` arguments. 99 | 100 | ## Defining the Fitted Model 101 | 102 | The fitted model is the regression model that will be fitted to the simulated data sampled from the true model. This model is specified using ```R``` formula syntax. Here, we will specify a simple regression of $Y$ on $X$ with no covariates, and will save it an object called ```fit.model```. **Note**: the fitted model's syntax must be a quoted string. 103 | 104 | ```{r} 105 | fit.model <- "Y ~ X" 106 | ``` 107 | 108 | ## Setting the other simulation parameters 109 | 110 | We must make a few final decisions before running ```regsim()```. They are: 111 | 112 | - ```reps```: The number of times that the simulation-estimation process will be repeated. Here there is a tradeoff between the accuracy of the results and computation time. I suggest at least 1,000 reps, hopefully more, before interpreting the results too seriously. 113 | 114 | - ```n```: The sample size generated for each rep. 115 | 116 | - ```targetparm```: Which parameter's estimate and standard error should be scrutinized? This is expressed as a quoted string. It must be a variable from the right-hand side of the fitted model. 117 | 118 | - ```targetval```: The true value of the relationship between the target parameter and the response variable as specified in the data generating model. In the path diagram considered in this example, the effect of $X$ on $Y$ is completely mediated by $M$. 119 | 120 | By path tracing rules, the total effect of one variable on another when the effect is mediated is equal to the direct effect plus the indirect (mediated) effect. In this case, the direct effect is zero, because there is no direct $X \rightarrow Y$ path in the data generating model. The indirect effect is the product of all the path coefficients in the chain $X \rightarrow M \rightarrow Y$. In this case, the indirect effect is $.5 \times .5 = .25$. We will use this value as our target value for $X$'s effect on $Y$. 121 | 122 | ## Doing the simulation 123 | 124 | The simulation is performed using the ```regsim()``` function. The ```true.model``` and ```fit.model``` objects, previously created, are passed as arguments. The simulation results are assigned to the ```result_1a``` object. A random number seed has been specified for reproducibility. 125 | 126 | Note that, by default, ```regsim()``` does not impose a standardized metric on the generated variables, so users do not have to worry about implying variable correlations greater than one. In other words, when ```standardized=FALSE```, path coefficients can be freely chosen. 127 | 128 | ```{r, cache=T} 129 | set.seed(123) 130 | 131 | result_1a <- regsim(reps=1000, n=100, true.model=true.model, 132 | fit.model=fit.model, targetparm="X", 133 | targetval=.25) 134 | 135 | ``` 136 | 137 | Before examining the results, let's verify that we specified the data generating model correctly. Running ```plot()``` on the ```regsim()``` output with the argument ```plot="model"``` will produce a path diagram corresponding to this model. 138 | 139 | ```{r, fig.width=5, fig.height=4.5} 140 | plot(result_1a, type="model") 141 | ``` 142 | 143 | This plot looks correct, but the path coefficients for $A \rightarrow Y$ and $B \rightarrow X$ are superimposed. We can try an alternate layout for the graph. See ```?lavaan::semPaths``` for details on the options (under 'layout'). In this case, the ```"spring"``` layout works better and avoids overplotting. 144 | 145 | ```{r, fig.width=5, fig.height=4.5} 146 | plot(result_1a, type="model", layout="spring") 147 | ``` 148 | 149 | Having verified that the data-generating model was set up correctly, let's examine the ```regsim()``` output. 150 | 151 | ```{r} 152 | result_1a 153 | ``` 154 | 155 | * ```$targetval``` The true value of the target parameter, $\beta$, which was specified when the function was called. It is used to calculate bias, RMSE, and coverage. 156 | 157 | * ```$expected.b``` The mean value of the target parameter estimate across all the simulated repetitions, $E(b)$. This value should closely approximate the corresponding true value. 158 | 159 | * ```$bias``` Bias is calculated as the mean of the difference between the true value of the target parameter and its estimate across repetitions, $E(b-\beta)$. This value should be close to zero when the model is correctly specified. 160 | 161 | * ```analytical.SE``` The average estimated standard error for the target parameter across the repetitions. The analytical standard error should closely approximate the empirical standard error if the model is correctly specified. A violation of certain regression assumptions can cause it to diverge from the empirical standard error. 162 | 163 | * ```empirical.SE``` The calculated standard deviation of the parameter estimates, $b$. The empirical standard error is an estimated of what the sampling variability of the parameter actually is. 164 | 165 | * ```$analytic.CI``` The mean lower and upper analytic confidence interval boundaries for the target parameter across repetitions based on the limits specified by the ```interval=``` argument. These should closely approximate the empirical confidence interval boundaries; when this does not occur, an assumption violation has likely occurred. 166 | 167 | * ```$empirical.CI``` The empirical percentiles of the estimated values of the target parameter at the limits specified by the ```interval=``` argument. By default these will be the 2.5th and 97.5th percentiles, corresponding to the 95% empirical confidence interval. 168 | 169 | * ```$coverage``` The proportion of repetitions in which the true value of the target parameter, $\beta$, is contained in the analytic confidence interval. The coverage rate should should approximate the confidence level for the interval if model assumptions are met. 170 | 171 | * ```$RMSE``` The root mean squared error, calculated as $\sqrt{E[(b - \beta)^2]}$. The RMSE is includes contributions from both sampling error and bias and is a single-value summary of how close, on average, estimates come to the true value. 172 | 173 | * ```$adjustment.sets``` The set(s) of covariates that, if included in the fitted regression model (argument ```fit.model=```), would allow for unbiased estimation of the target parameter. The adjustment sets are calculated using the ```adjustmentSets()``` function of the ```dagitty``` package. When the set is empty, no covariates are required. (**Note**: an empty adjustment set is represented by ```{}```. A non-existent adjustment set is represented by no output at all. A non-existent adjustment set indicate that no regression model can achieve unbiased estimation with the variables that are available.) 174 | 175 | 176 | The ```regsim()``` output includes a few other components which are not printed but are nonetheless available. The full contents can be inspected by running ```str()``` on the ```regsim()``` output. The other components of output include: 177 | 178 | * ```$true.model``` The data generating (true) model. 179 | 180 | * ```$fit.model``` The fitted model. 181 | 182 | * ```$b``` The vector of parameter estimates across repetitions. 183 | 184 | * ```$data``` A simulated dataset from the first repetition. (The data for the other repetitions is not available). 185 | 186 | * ```$true.DAG``` The data generating model expressed as a DAG of class ```dagitty```. 187 | 188 | ### Interpreting the results 189 | 190 | The results indicate that the fitted model is producing a biased estimated of the true effect of $X \rightarrow Y$. This is can clearly be observed in the discrepancy between the mean estimated value (```$expected.b```) and the true value, which is also represented in the ```$bias``` value. The empirical and analytic standard errors are quite close to one another, as are the confidence intervals, indicating that the problem with this model is in its fixed (structural) component. The bias results in a coverage rate that is far below its 95% nominal value. The RMSE is much larger than the standard error as a result of the bias. 191 | 192 | Because the fitted model is misspecified, the estimated effect of $X \rightarrow Y$ is biased. ```regsim()``` returns the parameter estimates across all of the repetitions in a list component ```$b```. Below is a histogram with a superimposed density plot of the parameter estimates. The true value of the relationship is indicated with a dashed vertical red line. The locations of the 2.5th and 97.5th percentiles (representing the empirical 95% confidence interval) are indicated with dotted vertical lines. 193 | 194 | This plot can be generated by running ```plot()``` on the ```regsim()``` output with ```type="perf"```. (The optional ```breaks=30``` argument increases the number of bars in the plot). 195 | 196 | ```{r, fig.width=4.5, fig.height=4.5} 197 | plot(result_1a, type="perf", breaks=30) 198 | ``` 199 | 200 | We can visualize the distribution of the simulated data in lots of ways. The easiest is to ```plot()``` the ```regsim()``` output using ```type="data"```. This plots the data from the first repetition of the simulation with the ```pairs.panels()``` function from the ```psych``` package. 201 | 202 | ```{r, fig.width=5.5, fig.height=5.5} 203 | plot(result_1a, type="data") 204 | ``` 205 | 206 | ### Obtaining an Unbiased Estimate of the Effect of X on Y 207 | 208 | The ```$adjustment.sets``` output indicates the source of the problem: variables $A$ and $B$ must be included in this model as covariates in order to correctly estimate the $X \rightarrow Y$ effect. Let's correctly specify this model and re-run the simulation. 209 | 210 | The ```fit.model=``` argument of the code is altered to include $A$ and $B$ in the model formula. 211 | 212 | ```{r, cache=T} 213 | result_1b <- regsim(reps=1000, n=100, true.model=true.model, 214 | fit.model="Y~X+A+B", targetparm="X", 215 | targetval=.25) 216 | 217 | result_1b 218 | ``` 219 | 220 | The results indicate good performance. Bias is very low, the coverage rate is nearly 95%, there is close correspondence between the analytic and empirical standard error and confidence intervals, and the RMSE is dominated by sampling error. 221 | 222 | An updated histogram / density plot of the parameter estimates illustrate that they are now centered on the true value of the parameter. 223 | 224 | ```{r, fig.width=4.5, fig.height=4.5} 225 | plot(result_1b, type="perf", breaks=30) 226 | ``` 227 | 228 | ### Misspecifying the Model by Conditioning on the Mediator 229 | 230 | In general, downstream descendants of the target parameter should not be included as covariates in an analysis. The only exception would be when explicit mediation modeling is intended. What happens if $M$ is added to the model as a covariate, in addition to $A$ and $B$? Simulation can answer that question. 231 | 232 | ```{r, cache=T} 233 | result_1c <- regsim(reps=1000, n=100, true.model=true.model, 234 | fit.model="Y~X+A+B+M", targetparm="X", 235 | targetval=.25) 236 | 237 | result_1c 238 | ``` 239 | 240 | As the results indicate, conditioning on the mediator is a bad idea. It results in an intensely biased estimate of the effect of $X$ on $Y$. In fact, the average estimated effect across all the repetitions is now zero. Note that the variable $M$ is not included in the ```$adjustment.sets``` component of the output. 241 | ```{r, fig.width=4.5, fig.height=4.5} 242 | plot(result_1c, type="perf", breaks=30) 243 | ``` 244 | 245 | # Example 2: Violating distributional assumptions 246 | 247 | The ```regsim()``` function can generate non-normal data via the optional ```skewness=``` and ```kurtosis=``` arguments. (These are passed to ```lavaan```'s ```simulateData``` function via ```...```). 248 | 249 | In this case the model will be a simple regression of $Y$ on $X$, but the variables will be generated such they they are skewed and kurtotic. The ```skewness=``` and ```kurtosis=``` arguments expect a vector of these values for each variable in the data-generating model. However, I do not understand how the underlying ```simulateData()``` function orders the variables. Thus, I find it necessary to experiment with the order, each time plotting the the first generated dataset (via the ```$data``` output component) until the desired result is obtained. 250 | 251 | I intend to generate data such that $Y$ is severely skewed and $X$ is not. I will try specifying ```skewness=c(4,0)```, hoping that the skewness will be applied to $Y$. Also, it is important to note that skewness and kurtosis are not independent; skewness implies kurtosis. If $\kappa$ is the full kurtosis of a distribution, and $\gamma$ is the skewness, then the following inequality must be satisfied. 252 | 253 | $$ 254 | \kappa \ge 1+\gamma^2 255 | $$ 256 | 257 | Non-normal data generation in ```regsim()``` is based on the algorithm presented by Vale and Maurelli (1983, as implemented in ```lavaan```'s ```simulateData()``` function) and is quite sensitive to the kurtosis value. Successful convergence appears to require kurtosis values well above those that would satisfy the inequality given above. Through trial and error I discovered that a kurtosis value of 26 or higher is needed to simulate data with a skewness of $\pm 4$. This is an extreme level of non-normality. 258 | 259 | ```{r, cache=T} 260 | result_2 <- regsim(reps=1000, n=500, true.model="Y~.5*X", 261 | fit.model="Y~X", targetparm="X", targetval=.5, 262 | kurtosis=c(26, 0), skewness=c(4, 0)) 263 | ``` 264 | 265 | If the provided kurtosis value is too small for the skewness, you will see the following error message. 266 | 267 | ```{r, echo=F, cache=T} 268 | discard <- regsim(reps=1000, n=30, true.model="Y~.5*X", fit.model="Y~X", targetparm="X", targetval=.5, kurtosis=c(0, 0), skewness=c(3, 0)) 269 | ``` 270 | 271 | In this case, you should not trust ```regsim()```'s output! 272 | 273 | Next, I examine the ```$data``` with ```psych```'s ```pairs.panels()``` function. 274 | 275 | ```{r, fig.width=5.5, fig.height=5.5} 276 | plot(result_2, type="data") 277 | ``` 278 | 279 | The plot show that the $Y$ variable was skewed as intended. 280 | 281 | Now let's examine the simulation results. 282 | 283 | ```{r} 284 | result_2 285 | ``` 286 | 287 | The results are unbiased, but the analytic standard errors are wrong. In fact, it is about half the magnitude that it should be. Consequently, the analytic 95% confidence interval is too narrow, and the coverage rate is only about 70%. A hypothesis test for this parameter would be *liberal*, meaning that its long-run false positive rate would be much higher than the alpha criterion should allow. 288 | 289 | The regression assumption that has been violated in this case is that the distribution of the residuals does not follow a normal distribution. The structural part of the model is fine. The incorrect residual distribution manifests as an improperly-shaped shaped sampling distribution for the parameter estimates. 290 | 291 | Below is a density plot of the empirical sampling distribution. The analytic sampling distribution is shown as the blue dotted curve. This plot can be obtained by running ```plot()``` on the ```regsim()``` output with ```type="compareSE"```. When the regression assumptions are met, these two distributions are identical in expectation. But they diverge when assumptions are violated. The true value of the parameter is denoted by the red vertical line. 292 | 293 | ```{r, fig.width=4.5, fig.height=4.5} 294 | plot(result_2, type="compareSE") 295 | ``` 296 | 297 | Not only is the empirical sampling distribution platykurtotic, it is also slightly skewed to the right. 298 | 299 | This is a rather extreme example of non-normality. Linear regression works reasonably well for minor departures from the normality assumption. 300 | 301 | # Example 3: Measurement error 302 | 303 | Measurement error is a ubiquitous feature of real data. Linear regression models assume that the predictor variables are measured without error. No such assumption is made about the response variable. We can explore this issue with simulation. 304 | 305 | The **reliability** of a variable describes the proportion of its variance that is true score rather than measurement error. Many assessments in psychology have reliability coefficients of 0.7 to 0.9. Single item indicators often have reliability coefficients in the 0.5 range. 306 | 307 | ## Measurement error in predictor variables 308 | 309 | Let us imagine that we can measure variable $X$ with a reliability of 0.8. According to classical test theory, the observed score $X_{O}$ is composed of a true score component $X_{T}$ plus measurement error component $X_{E}$. 310 | 311 | This situation can be represented by the following figure. 312 | 313 | ```{r, echo=F, cache=T, fig.width=4.5, fig.height=3.5} 314 | 315 | true.model <- "X_T =~ 1*X_O 316 | X_T ~~ 1*X_T 317 | X_O ~~ .25*X_O 318 | Y ~ .5*X_T 319 | Y ~~ 1*Y" 320 | 321 | coord <- matrix(c( 322 | 0,0, #Xobs 323 | 2,0, #Y 324 | 1,1), byrow=T, ncol=2) 325 | 326 | fig_3a <- regsim(reps=1000, n=300, true.model=true.model, 327 | fit.model="Y~X_O", targetparm="X_O", targetval=.5) 328 | 329 | plot(fig_3a, type="model", layout=coord, whatLabels="no") 330 | ``` 331 | 332 | Two key equations in classical test theory are 333 | 334 | $Var(X) = Var(T) + Var(E)]$ 335 | 336 | and 337 | 338 | $\rho_{XX} = Var(T) / [Var(T) + Var(E)]$ 339 | 340 | where $\rho_{XX}$ is the reliability coefficient, $X$ is the observed score, $T$ is the true score, and $E$ is measurement error. These equations provide guidance for setting the parameters of the data generating model in order to produce an observed $X$ variable with the desired reliability. Let us assume that the exogenous latent true score $X_T$ exists on a standardized metric with unit variance. Let us set the loading relating the observed score $X_O$ to the true score to be one. Then the true score contribution to $X_O$'s variance is 1.0 (because of the rule $Var(bX) = b^2 Var(X)$). The variance of the observed score must exceed the true score variance because the measurement error variance is additive. A bit of algebra allows us to solve for the residual variance required to produce $X_O$ with the desired reliability. 341 | 342 | $Var(E) = (1 / \rho_{XX}) - 1$ 343 | 344 | In this case, to produce a reliability of 0.8, the error variance must be set to 0.25. 345 | 346 | The following diagram represents the data-generating model for this situation. 347 | 348 | ```{r, echo=F, cache=T, fig.width=4.5, fig.height=3.5} 349 | plot(fig_3a, type="model", layout=coord, resid=T) 350 | ``` 351 | 352 | Note that the residual variance for $X_O$ has been set to 0.25, which represents the error variance. Its its true score variance is 1, and therefore its total variance is therefore 1.25. Finally, $1 / 1.25 = .80$, the desired reliability coefficient. 353 | 354 | Note that there is no path from $X_{O}$ to $Y$. $Y$ is caused by the true value, $X_{T}$, and not by the observed $X_{O}$. In fact, the true score is a confounder. The true value of $X_{O} \rightarrow Y$ is actually zero! 355 | 356 | The code to define the data generating model is as follows. 357 | 358 | ```{r} 359 | true.model <- "X_T =~ 1*X_O 360 | X_T ~~ 1*X_T 361 | X_O ~~ .25*X_O 362 | Y ~ .5*X_T" 363 | ``` 364 | 365 | In ```lavaan``` syntax, the symbol ```=~``` is read "measured by" and is used to define latent variables in terms of observed indicators. In this case, the true score is latent and is measured by the observed score $X_O$ with its loading fixed to one. The symbol ```~~``` is used to specify variances or residual variances. In the syntax above, $X_T$'s total variance is set to one, and $X_O$'s residual variance is set to 0.25. Finally, ```~``` represents path coefficients (read "regressed on" or "caused by") as before. 366 | 367 | Next, we run the simulation. Also note that the target value I have set is equal to the effect of $X_T \rightarrow Y$, not the zero effect of $X_O \rightarrow Y$. Because $X_T$ is defined as a latent variable, it will not appear in the simulated datasets produced by ```regsim()```. 368 | 369 | ```{r, cache=T} 370 | result_3a <- regsim(reps=1000, n=300, true.model=true.model, 371 | fit.model="Y~X_O", targetparm="X_O", targetval=.5) 372 | result_3a 373 | ``` 374 | 375 | The results indicate that the estimated effect of $X_O \rightarrow Y$ is biased. 376 | Linear regression models assume that the predictor variables are measured without error. Thus, we cannot obtain an unbiased estimate of the effect of $X \rightarrow Y$ when $X$ is measured with error. In general, predictor variables cannot be replaced by noisy proxies without harming inferences. The bias can be visualized by plotting the ```regsim()``` output with ```type="perf"```. 377 | 378 | ```{r, fig.height=3.5, fig.width=4.5} 379 | plot(result_3a, type="perf", breaks=30) 380 | ``` 381 | 382 | Noisy proxies of predictor variables are not ideal, but they are generally best that we can achieve, because all acts of measurement involve measurement error. The magnitude of the bias is directly related to the measurement reliability of the predictor variable. Thus, it is crucial to measure predictor variables as precisely as possible. Measurement error bias is no different than confounding bias. Both forms are caused by omitted variables. 383 | 384 | ## Measurement error in the response variable 385 | 386 | Linear regression models do not assume that the response variable is measured without error. We can modify our previous analysis to illustrate what happens when $Y$, rather than $X$, is measured with error. The new data generating model looks like this: 387 | 388 | ```{r, echo=F, cache=T, fig.width=4.5, fig.height=3.5} 389 | 390 | true.model <- "Y_T =~ 1*Y_O 391 | Y_T ~~ 1*Y_T 392 | Y_O ~~ .25*Y_O 393 | Y_T ~ .5*X" 394 | 395 | coord <- matrix(c( 396 | 2,0, #Xobs 397 | 0,0, #Y 398 | 1,1), byrow=T, ncol=2) 399 | 400 | fig_3b <- regsim(reps=1000, n=300, true.model=true.model, 401 | fit.model="Y_O~X", targetparm="X", targetval=.5) 402 | 403 | plot(fig_3b, type="model", layout=coord, resid=T) 404 | ``` 405 | 406 | It can be defined as follows. 407 | 408 | ```{r} 409 | true.model <- "Y_T =~ 1*Y_O 410 | Y_T ~~ 1*Y_T 411 | Y_O ~~ .25*Y_O 412 | Y_T ~ .5*X" 413 | ``` 414 | 415 | The ```regsim()``` output confirms that the results are unbiased even though $Y$ is measured with error. 416 | 417 | 418 | ```{r, cache=T} 419 | result_3b <- regsim(reps=1000, n=300, true.model=true.model, 420 | fit.model="Y_O~X", targetparm="X", targetval=.5) 421 | result_3b 422 | ``` 423 | 424 | Plotting the results illustrates the unbiased estimation. 425 | 426 | ```{r, fig.width=4.5, fig.height=4.5} 427 | plot(result_3b, type="perf", breaks=30) 428 | ``` 429 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | `regsim` is an `R` package to make simulation quick and easy. It can be installed from github with the following `R` code. 2 | 3 | ``` r 4 | # the following two lines need only to be run once 5 | install.packages("devtools") 6 | devtools::install_github("mcbeem/regsim") 7 | 8 | # add regsim's functions to R namespace so they can be used 9 | library(regsim) 10 | ``` 11 | 12 | Example 1: Confounders and mediators 13 | ==================================== 14 | 15 | A researcher envisions the following true data-generating process: 16 | 17 | ![](readme_files/figure-markdown_github/unnamed-chunk-4-1.png) 18 | 19 | And is interested in estimating the effect of *X* on *Y* using a linear regression model of the following form: 20 | 21 | *Y**i* = *b*0 + *b*1(*X**i*)+...+*e**i* 22 | 23 | where ... potentially contains the effect of a set of *covariates* or *adjustment variables*. In this case, those covariates could include any combination of *A*, *B*, or *M*. What are the consequences of different choices? Simulation is a useful technique for exploring the results of analytic decisions. One reason it is so useful is that the true model, and the correct effect of *X* → *Y*, is known. Thus, the estimates produced by linear regression can be compared to the known, true values. 24 | 25 | Defining the Data Generating (True) Model 26 | ----------------------------------------- 27 | 28 | The process of specifying the data generating model is simple. 29 | 30 | 1. **Sketch the path diagram (or SEM) describing the true model**. The process begins by sketching out a path diagram of the relationships between the variables. The arrows indicate not only causation, but in this case also imply a linear functional form. Each arrow must be assigned a *path coefficient*; a regression slope describing how much the downstream variable will change in response to an isolated-one unit change of the upstream variable. 31 | 32 | 2. **Classify the variables**. Next, the variables in the diagram are classified as either **exogenous** or **endogenous**. An exogenous variable has no arrow directed towards it; it has no in-system causes. An endogenous variable has at least one arrow directed toward it. In our example, variables *A* and *B* are exogenous, while *X*, *M*, and *Y* are endogenous. 33 | 34 | 3. **Write models for the endogenous variables**. Each exogenous variable must be described in terms of its causes. The syntax is similar to `R`'s model formula used in `lm()` and many other model-fitting routines. In our example path diagram, *X*, *M*, and *Y* were endogenous, so a model for each one will need to be provided. 35 | 36 | Let's begin by examining *X*, which is caused by *A* and *B* according to our diagram. In `R`'s formula syntax, we would write: 37 | 38 | ``` r 39 | X ~ A + B 40 | ``` 41 | 42 | Where the `~` character is read "predicted by" or "regressed on." This formula corresponds to a regression model of the form: 43 | 44 | *X**i* = *b*0 + *b*1(*A**i*)+*b*2(*B**i*)+*e**i* 45 | 46 | Since we are specifying the true model, we must provide values for parameters *b*1 and *b*2. The intercept, *b*0, and the residual variance *e**i* are nuisance parameters in many simulation applications. We do not need to choose values for them when using `regsim()` to simulate data. The `regsim()` function uses the `simulateSEM()` function from the `lavaan` package to do the data generation. 47 | 48 | Let's choose values of 0.5 for both *b*1 and *b*2. The model for *X*, expressed in the proper syntax for `regsim()`, is as follows. 49 | 50 | ``` r 51 | X ~ .5*A + .5*B 52 | ``` 53 | 54 | We must do the same for the endogenous variables *M* and *Y*. Variable *M* has only one arrow pointing to it, so its model has only one predictor variable, *X*. Choosing 0.5 as the path coefficient for *X* → *M*, *M*'s model is written: 55 | 56 | ``` r 57 | M ~ .5*X 58 | ``` 59 | 60 | Finally, *Y* is caused by *A*, *B*, and *M*, so its model must include these variables. Sticking with 0.5 as our arbitrary value for all the path coefficients, the model for *Y* is written: 61 | 62 | ``` r 63 | Y ~ .5*A + .5*B + .5*M 64 | ``` 65 | 66 | We will create an object called `true.model` that will be passed to `regsim()` to describe the model. It will consist of a quoted string including all three of the models specified above. These must be separated with line breaks. The full `lavaan` syntax is available for data generation, including latent variables. 67 | 68 | ``` r 69 | true.model <- "X ~ .5*A + .5*B 70 | M ~ .5*X 71 | Y ~ .5*M + .5*A + .5*B" 72 | ``` 73 | 74 | By default, `regsim()` will sample the exogenous as well as the residuals for the endogenous variables from independent normal distributions. You can alter the distribution, to some extent, via the optional `kurtosis=` and `skewness=` arguments. 75 | 76 | Defining the Fitted Model 77 | ------------------------- 78 | 79 | The fitted model is the regression model that will be fitted to the simulated data sampled from the true model. This model is specified using `R` formula syntax. Here, we will specify a simple regression of *Y* on *X* with no covariates, and will save it an object called `fit.model`. **Note**: the fitted model's syntax must be a quoted string. 80 | 81 | ``` r 82 | fit.model <- "Y ~ X" 83 | ``` 84 | 85 | Setting the other simulation parameters 86 | --------------------------------------- 87 | 88 | We must make a few final decisions before running `regsim()`. They are: 89 | 90 | - `reps`: The number of times that the simulation-estimation process will be repeated. Here there is a tradeoff between the accuracy of the results and computation time. I suggest at least 1,000 reps, hopefully more, before interpreting the results too seriously. 91 | 92 | - `n`: The sample size generated for each rep. 93 | 94 | - `targetparm`: Which parameter's estimate and standard error should be scrutinized? This is expressed as a quoted string. It must be a variable from the right-hand side of the fitted model. 95 | 96 | - `targetval`: The true value of the relationship between the target parameter and the response variable as specified in the data generating model. In the path diagram considered in this example, the effect of *X* on *Y* is completely mediated by *M*. 97 | 98 | By path tracing rules, the total effect of one variable on another when the effect is mediated is equal to the direct effect plus the indirect (mediated) effect. In this case, the direct effect is zero, because there is no direct *X* → *Y* path in the data generating model. The indirect effect is the product of all the path coefficients in the chain *X* → *M* → *Y*. In this case, the indirect effect is .5 × .5 = .25. We will use this value as our target value for *X*'s effect on *Y*. 99 | 100 | Doing the simulation 101 | -------------------- 102 | 103 | The simulation is performed using the `regsim()` function. The `true.model` and `fit.model` objects, previously created, are passed as arguments. The simulation results are assigned to the `result_1a` object. A random number seed has been specified for reproducibility. 104 | 105 | Note that, by default, `regsim()` does not impose a standardized metric on the generated variables, so users do not have to worry about implying variable correlations greater than one. In other words, when `standardized=FALSE`, path coefficients can be freely chosen. 106 | 107 | ``` r 108 | set.seed(123) 109 | 110 | result_1a <- regsim(reps=1000, n=100, true.model=true.model, 111 | fit.model=fit.model, targetparm="X", 112 | targetval=.25) 113 | ``` 114 | 115 | Before examining the results, let's verify that we specified the data generating model correctly. Running `plot()` on the `regsim()` output with the argument `plot="model"` will produce a path diagram corresponding to this model. 116 | 117 | ``` r 118 | plot(result_1a, type="model") 119 | ``` 120 | 121 | ![](readme_files/figure-markdown_github/unnamed-chunk-12-1.png) 122 | 123 | This plot looks correct, but the path coefficients for *A* → *Y* and *B* → *X* are superimposed. We can try an alternate layout for the graph. See `?lavaan::semPaths` for details on the options (under 'layout'). In this case, the `"spring"` layout works better and avoids overplotting. 124 | 125 | ``` r 126 | plot(result_1a, type="model", layout="spring") 127 | ``` 128 | 129 | ![](readme_files/figure-markdown_github/unnamed-chunk-13-1.png) 130 | 131 | Having verified that the data-generating model was set up correctly, let's examine the `regsim()` output. 132 | 133 | ``` r 134 | result_1a 135 | ``` 136 | 137 | ## $targetval 138 | ## [1] 0.25 139 | ## 140 | ## $expected.b 141 | ## [1] 0.5843389 142 | ## 143 | ## $bias 144 | ## [1] 0.3343389 145 | ## 146 | ## $analytic.SE 147 | ## [1] 0.10401 148 | ## 149 | ## $empirical.SE 150 | ## [1] 0.09922978 151 | ## 152 | ## $analytic.CI 153 | ## 2.5% 97.5% 154 | ## 0.3779346 0.7907433 155 | ## 156 | ## $empirical.CI 157 | ## 2.5% 97.5% 158 | ## 0.3788186 0.7775613 159 | ## 160 | ## $coverage 161 | ## [1] 0.104 162 | ## 163 | ## $RMSE 164 | ## [1] 0.3487395 165 | ## 166 | ## $adjustment.sets 167 | ## { A, B } 168 | 169 | - `$targetval` The true value of the target parameter, *β*, which was specified when the function was called. It is used to calculate bias, RMSE, and coverage. 170 | 171 | - `$expected.b` The mean value of the target parameter estimate across all the simulated repetitions, *E*(*b*). This value should closely approximate the corresponding true value. 172 | 173 | - `$bias` Bias is calculated as the mean of the difference between the true value of the target parameter and its estimate across repetitions, *E*(*b* − *β*). This value should be close to zero when the model is correctly specified. 174 | 175 | - `analytical.SE` The average estimated standard error for the target parameter across the repetitions. The analytical standard error should closely approximate the empirical standard error if the model is correctly specified. A violation of certain regression assumptions can cause it to diverge from the empirical standard error. 176 | 177 | - `empirical.SE` The calculated standard deviation of the parameter estimates, *b*. The empirical standard error is an estimated of what the sampling variability of the parameter actually is. 178 | 179 | - `$analytic.CI` The mean lower and upper analytic confidence interval boundaries for the target parameter across repetitions based on the limits specified by the `interval=` argument. These should closely approximate the empirical confidence interval boundaries; when this does not occur, an assumption violation has likely occurred. 180 | 181 | - `$empirical.CI` The empirical percentiles of the estimated values of the target parameter at the limits specified by the `interval=` argument. By default these will be the 2.5th and 97.5th percentiles, corresponding to the 95% empirical confidence interval. 182 | 183 | - `$coverage` The proportion of repetitions in which the true value of the target parameter, *β*, is contained in the analytic confidence interval. The coverage rate should should approximate the confidence level for the interval if model assumptions are met. 184 | 185 | - `$RMSE` The root mean squared error, calculated as *sqrt*(*E*[(*b* − *β*)^2]). The RMSE is includes contributions from both sampling error and bias and is a single-value summary of how close, on average, estimates come to the true value. 186 | 187 | - `$adjustment.sets` The set(s) of covariates that, if included in the fitted regression model (argument `fit.model=`), would allow for unbiased estimation of the target parameter. The adjustment sets are calculated using the `adjustmentSets()` function of the `dagitty` package. When the set is empty, no covariates are required. (**Note**: an empty adjustment set is represented by `{}`. A non-existent adjustment set is represented by no output at all. A non-existent adjustment set indicate that no regression model can achieve unbiased estimation with the variables that are available.) 188 | 189 | The `regsim()` output includes a few other components which are not printed but are nonetheless available. The full contents can be inspected by running `str()` on the `regsim()` output. The other components of output include: 190 | 191 | - `$true.model` The data generating (true) model. 192 | 193 | - `$fit.model` The fitted model. 194 | 195 | - `$b` The vector of parameter estimates across repetitions. 196 | 197 | - `$data` A simulated dataset from the first repetition. (The data for the other repetitions is not available). 198 | 199 | - `$true.DAG` The data generating model expressed as a DAG of class `dagitty`. 200 | 201 | ### Interpreting the results 202 | 203 | The results indicate that the fitted model is producing a biased estimated of the true effect of *X* → *Y*. This is can clearly be observed in the discrepancy between the mean estimated value (`$expected.b`) and the true value, which is also represented in the `$bias` value. The empirical and analytic standard errors are quite close to one another, as are the confidence intervals, indicating that the problem with this model is in its fixed (structural) component. The bias results in a coverage rate that is far below its 95% nominal value. The RMSE is much larger than the standard error as a result of the bias. 204 | 205 | Because the fitted model is misspecified, the estimated effect of *X* → *Y* is biased. `regsim()` returns the parameter estimates across all of the repetitions in a list component `$b`. Below is a histogram with a superimposed density plot of the parameter estimates. The true value of the relationship is indicated with a dashed vertical red line. The locations of the 2.5th and 97.5th percentiles (representing the empirical 95% confidence interval) are indicated with dotted vertical lines. 206 | 207 | This plot can be generated by running `plot()` on the `regsim()` output with `type="perf"`. (The optional `breaks=30` argument increases the number of bars in the plot). 208 | 209 | ``` r 210 | plot(result_1a, type="perf", breaks=30) 211 | ``` 212 | 213 | ![](readme_files/figure-markdown_github/unnamed-chunk-15-1.png) 214 | 215 | We can visualize the distribution of the simulated data in lots of ways. The easiest is to `plot()` the `regsim()` output using `type="data"`. This plots the data from the first repetition of the simulation with the `pairs.panels()` function from the `psych` package. 216 | 217 | ``` r 218 | plot(result_1a, type="data") 219 | ``` 220 | 221 | ![](readme_files/figure-markdown_github/unnamed-chunk-16-1.png) 222 | 223 | ### Obtaining an Unbiased Estimate of the Effect of X on Y 224 | 225 | The `$adjustment.sets` output indicates the source of the problem: variables *A* and *B* must be included in this model as covariates in order to correctly estimate the *X* → *Y* effect. Let's correctly specify this model and re-run the simulation. 226 | 227 | The `fit.model=` argument of the code is altered to include *A* and *B* in the model formula. 228 | 229 | ``` r 230 | result_1b <- regsim(reps=1000, n=100, true.model=true.model, 231 | fit.model="Y~X+A+B", targetparm="X", 232 | targetval=.25) 233 | 234 | result_1b 235 | ``` 236 | 237 | ## $targetval 238 | ## [1] 0.25 239 | ## 240 | ## $expected.b 241 | ## [1] 0.2435049 242 | ## 243 | ## $bias 244 | ## [1] -0.006495071 245 | ## 246 | ## $analytic.SE 247 | ## [1] 0.1133802 248 | ## 249 | ## $empirical.SE 250 | ## [1] 0.1167926 251 | ## 252 | ## $analytic.CI 253 | ## 2.5% 97.5% 254 | ## 0.01844698 0.46856288 255 | ## 256 | ## $empirical.CI 257 | ## 2.5% 97.5% 258 | ## 0.02176829 0.47546433 259 | ## 260 | ## $coverage 261 | ## [1] 0.942 262 | ## 263 | ## $RMSE 264 | ## [1] 0.1169148 265 | ## 266 | ## $adjustment.sets 267 | ## { A, B } 268 | 269 | The results indicate good performance. Bias is very low, the coverage rate is nearly 95%, there is close correspondence between the analytic and empirical standard error and confidence intervals, and the RMSE is dominated by sampling error. 270 | 271 | An updated histogram / density plot of the parameter estimates illustrate that they are now centered on the true value of the parameter. 272 | 273 | ``` r 274 | plot(result_1b, type="perf", breaks=30) 275 | ``` 276 | 277 | ![](readme_files/figure-markdown_github/unnamed-chunk-18-1.png) 278 | 279 | ### Misspecifying the Model by Conditioning on the Mediator 280 | 281 | In general, downstream descendants of the target parameter should not be included as covariates in an analysis. The only exception would be when explicit mediation modeling is intended. What happens if *M* is added to the model as a covariate, in addition to *A* and *B*? Simulation can answer that question. 282 | 283 | ``` r 284 | result_1c <- regsim(reps=1000, n=100, true.model=true.model, 285 | fit.model="Y~X+A+B+M", targetparm="X", 286 | targetval=.25) 287 | 288 | result_1c 289 | ``` 290 | 291 | ## $targetval 292 | ## [1] 0.25 293 | ## 294 | ## $expected.b 295 | ## [1] 0.0003883205 296 | ## 297 | ## $bias 298 | ## [1] -0.2496117 299 | ## 300 | ## $analytic.SE 301 | ## [1] 0.114455 302 | ## 303 | ## $empirical.SE 304 | ## [1] 0.1122119 305 | ## 306 | ## $analytic.CI 307 | ## 2.5% 97.5% 308 | ## -0.2268336 0.2276103 309 | ## 310 | ## $empirical.CI 311 | ## 2.5% 97.5% 312 | ## -0.2231423 0.2207332 313 | ## 314 | ## $coverage 315 | ## [1] 0.417 316 | ## 317 | ## $RMSE 318 | ## [1] 0.2736511 319 | ## 320 | ## $adjustment.sets 321 | ## { A, B } 322 | 323 | As the results indicate, conditioning on the mediator is a bad idea. It results in an intensely biased estimate of the effect of *X* on *Y*. In fact, the average estimated effect across all the repetitions is now zero. Note that the variable *M* is not included in the `$adjustment.sets` component of the output. 324 | 325 | ``` r 326 | plot(result_1c, type="perf", breaks=30) 327 | ``` 328 | 329 | ![](readme_files/figure-markdown_github/unnamed-chunk-20-1.png) 330 | 331 | Example 2: Violating distributional assumptions 332 | =============================================== 333 | 334 | The `regsim()` function can generate non-normal data via the optional `skewness=` and `kurtosis=` arguments. (These are passed to `lavaan`'s `simulateData` function via `...`). 335 | 336 | In this case the model will be a simple regression of *Y* on *X*, but the variables will be generated such they they are skewed and kurtotic. The `skewness=` and `kurtosis=` arguments expect a vector of these values for each variable in the data-generating model. However, I do not understand how the underlying `simulateData()` function orders the variables. Thus, I find it necessary to experiment with the order, each time plotting the the first generated dataset (via the `$data` output component) until the desired result is obtained. 337 | 338 | I intend to generate data such that *Y* is severely skewed and *X* is not. I will try specifying `skewness=c(4,0)`, hoping that the skewness will be applied to *Y*. Also, it is important to note that skewness and kurtosis are not independent; skewness implies kurtosis. If *κ* is the full kurtosis of a distribution, and *γ* is the skewness, then the following inequality must be satisfied. 339 | 340 | *κ* ≥ 1 + *γ*2 341 | 342 | Non-normal data generation in `regsim()` is based on the algorithm presented by Vale and Maurelli (1983, as implemented in `lavaan`'s `simulateData()` function) and is quite sensitive to the kurtosis value. Successful convergence appears to require kurtosis values well above those that would satisfy the inequality given above. Through trial and error I discovered that a kurtosis value of 26 or higher is needed to simulate data with a skewness of ±4. This is an extreme level of non-normality. 343 | 344 | ``` r 345 | result_2 <- regsim(reps=1000, n=500, true.model="Y~.5*X", 346 | fit.model="Y~X", targetparm="X", targetval=.5, 347 | kurtosis=c(26, 0), skewness=c(4, 0)) 348 | ``` 349 | 350 | If the provided kurtosis value is too small for the skewness, you will see the following error message. 351 | 352 | ## Warning in fleishman1978_abcd(skewness = SK[i], kurtosis = KU[i]): lavaan 353 | ## WARNING: ValeMaurelli1983 method did not convergence, or it did not find 354 | ## the roots 355 | 356 | In this case, you should not trust `regsim()`'s output! 357 | 358 | Next, I examine the `$data` with `psych`'s `pairs.panels()` function. 359 | 360 | ``` r 361 | plot(result_2, type="data") 362 | ``` 363 | 364 | ![](readme_files/figure-markdown_github/unnamed-chunk-23-1.png) 365 | 366 | The plot show that the *Y* variable was skewed as intended. 367 | 368 | Now let's examine the simulation results. 369 | 370 | ``` r 371 | result_2 372 | ``` 373 | 374 | ## $targetval 375 | ## [1] 0.5 376 | ## 377 | ## $expected.b 378 | ## [1] 0.4997811 379 | ## 380 | ## $bias 381 | ## [1] -0.0002188914 382 | ## 383 | ## $analytic.SE 384 | ## [1] 0.04450613 385 | ## 386 | ## $empirical.SE 387 | ## [1] 0.08573579 388 | ## 389 | ## $analytic.CI 390 | ## 2.5% 97.5% 391 | ## 0.4123382 0.5872240 392 | ## 393 | ## $empirical.CI 394 | ## 2.5% 97.5% 395 | ## 0.3393903 0.6701404 396 | ## 397 | ## $coverage 398 | ## [1] 0.696 399 | ## 400 | ## $RMSE 401 | ## [1] 0.08569319 402 | ## 403 | ## $adjustment.sets 404 | ## {} 405 | 406 | The results are unbiased, but the analytic standard errors are wrong. In fact, it is about half the magnitude that it should be. Consequently, the analytic 95% confidence interval is too narrow, and the coverage rate is only about 70%. A hypothesis test for this parameter would be *liberal*, meaning that its long-run false positive rate would be much higher than the alpha criterion should allow. 407 | 408 | The regression assumption that has been violated in this case is that the distribution of the residuals does not follow a normal distribution. The structural part of the model is fine. The incorrect residual distribution manifests as an improperly-shaped shaped sampling distribution for the parameter estimates. 409 | 410 | Below is a density plot of the empirical sampling distribution. The analytic sampling distribution is shown as the blue dotted curve. This plot can be obtained by running `plot()` on the `regsim()` output with `type="compareSE"`. When the regression assumptions are met, these two distributions are identical in expectation. But they diverge when assumptions are violated. The true value of the parameter is denoted by the red vertical line. 411 | 412 | ``` r 413 | plot(result_2, type="compareSE") 414 | ``` 415 | 416 | ![](readme_files/figure-markdown_github/unnamed-chunk-25-1.png) 417 | 418 | Not only is the empirical sampling distribution platykurtotic, it is also slightly skewed to the right. 419 | 420 | This is a rather extreme example of non-normality. Linear regression works reasonably well for minor departures from the normality assumption. 421 | 422 | Example 3: Measurement error 423 | ============================ 424 | 425 | Measurement error is a ubiquitous feature of real data. Linear regression models assume that the predictor variables are measured without error. No such assumption is made about the response variable. We can explore this issue with simulation. 426 | 427 | The **reliability** of a variable describes the proportion of its variance that is true score rather than measurement error. Many assessments in psychology have reliability coefficients of 0.7 to 0.9. Single item indicators often have reliability coefficients in the 0.5 range. 428 | 429 | Measurement error in predictor variables 430 | ---------------------------------------- 431 | 432 | Let us imagine that we can measure variable *X* with a reliability of 0.8. According to classical test theory, the observed score *X**O* is composed of a true score component *X**T* plus measurement error component *X**E*. 433 | 434 | This situation can be represented by the following figure. 435 | 436 | ![](readme_files/figure-markdown_github/unnamed-chunk-26-1.png) 437 | 438 | Two key equations in classical test theory are 439 | 440 | *V**a**r*(*X*)=*V**a**r*(*T*)+*V**a**r*(*E*)\] 441 | 442 | and 443 | 444 | *ρ**XX* = *V**a**r*(*T*)/\[*V**a**r*(*T*)+*V**a**r*(*E*)\] 445 | 446 | where *ρ**XX* is the reliability coefficient, *X* is the observed score, *T* is the true score, and *E* is measurement error. These equations provide guidance for setting the parameters of the data generating model in order to produce an observed *X* variable with the desired reliability. Let us assume that the exogenous latent true score *X**T* exists on a standardized metric with unit variance. Let us set the loading relating the observed score *X**O* to the true score to be one. Then the true score contribution to *X**O*'s variance is 1.0 (because of the rule *V**a**r*(*bX*)=*b*2*V**a**r*(*X*)). The variance of the observed score must exceed the true score variance because the measurement error variance is additive. A bit of algebra allows us to solve for the residual variance required to produce *X**O* with the desired reliability. 447 | 448 | *V**a**r*(*E*)=(1/*ρ**XX*)−1 449 | 450 | In this case, to produce a reliability of 0.8, the error variance must be set to 0.25. 451 | 452 | The following diagram represents the data-generating model for this situation. 453 | 454 | ![](readme_files/figure-markdown_github/unnamed-chunk-27-1.png) 455 | 456 | Note that the residual variance for *X**O* has been set to 0.25, which represents the error variance. Its its true score variance is 1, and therefore its total variance is therefore 1.25. Finally, 1/1.25 = .80, the desired reliability coefficient. 457 | 458 | Note that there is no path from *X**O* to *Y*. *Y* is caused by the true value, *X**T*, and not by the observed *X**O*. In fact, the true score is a confounder. The true value of *X**O* → *Y* is actually zero! 459 | 460 | The code to define the data generating model is as follows. 461 | 462 | ``` r 463 | true.model <- "X_T =~ 1*X_O 464 | X_T ~~ 1*X_T 465 | X_O ~~ .25*X_O 466 | Y ~ .5*X_T" 467 | ``` 468 | 469 | In `lavaan` syntax, the symbol `=~` is read "measured by" and is used to define latent variables in terms of observed indicators. In this case, the true score is latent and is measured by the observed score *X**O* with its loading fixed to one. The symbol `~~` is used to specify variances or residual variances. In the syntax above, *X**T*'s total variance is set to one, and *X**O*'s residual variance is set to 0.25. Finally, `~` represents path coefficients (read "regressed on" or "caused by") as before. 470 | 471 | Next, we run the simulation. Also note that the target value I have set is equal to the effect of *X**T* → *Y*, not the zero effect of *X**O* → *Y*. Because *X**T* is defined as a latent variable, it will not appear in the simulated datasets produced by `regsim()`. 472 | 473 | ``` r 474 | result_3a <- regsim(reps=1000, n=300, true.model=true.model, 475 | fit.model="Y~X_O", targetparm="X_O", targetval=.5) 476 | result_3a 477 | ``` 478 | 479 | ## $targetval 480 | ## [1] 0.5 481 | ## 482 | ## $expected.b 483 | ## [1] 0.4023442 484 | ## 485 | ## $bias 486 | ## [1] -0.09765579 487 | ## 488 | ## $analytic.SE 489 | ## [1] 0.05314453 490 | ## 491 | ## $empirical.SE 492 | ## [1] 0.05083078 493 | ## 494 | ## $analytic.CI 495 | ## 2.5% 97.5% 496 | ## 0.2977581 0.5069303 497 | ## 498 | ## $empirical.CI 499 | ## 2.5% 97.5% 500 | ## 0.3049644 0.5061742 501 | ## 502 | ## $coverage 503 | ## [1] 0.555 504 | ## 505 | ## $RMSE 506 | ## [1] 0.1100811 507 | ## 508 | ## $adjustment.sets 509 | 510 | The results indicate that the estimated effect of *X**O* → *Y* is biased. Linear regression models assume that the predictor variables are measured without error. Thus, we cannot obtain an unbiased estimate of the effect of *X* → *Y* when *X* is measured with error. In general, predictor variables cannot be replaced by noisy proxies without harming inferences. The bias can be visualized by plotting the `regsim()` output with `type="perf"`. 511 | 512 | ``` r 513 | plot(result_3a, type="perf", breaks=30) 514 | ``` 515 | 516 | ![](readme_files/figure-markdown_github/unnamed-chunk-30-1.png) 517 | 518 | Noisy proxies of predictor variables are not ideal, but they are generally best that we can achieve, because all acts of measurement involve measurement error. The magnitude of the bias is directly related to the measurement reliability of the predictor variable. Thus, it is crucial to measure predictor variables as precisely as possible. Measurement error bias is no different than confounding bias. Both forms are caused by omitted variables. 519 | 520 | Measurement error in the response variable 521 | ------------------------------------------ 522 | 523 | Linear regression models do not assume that the response variable is measured without error. We can modify our previous analysis to illustrate what happens when *Y*, rather than *X*, is measured with error. The new data generating model looks like this: 524 | 525 | ![](readme_files/figure-markdown_github/unnamed-chunk-31-1.png) 526 | 527 | It can be defined as follows. 528 | 529 | ``` r 530 | true.model <- "Y_T =~ 1*Y_O 531 | Y_T ~~ 1*Y_T 532 | Y_O ~~ .25*Y_O 533 | Y_T ~ .5*X" 534 | ``` 535 | 536 | The `regsim()` output confirms that the results are unbiased even though *Y* is measured with error. 537 | 538 | ``` r 539 | result_3b <- regsim(reps=1000, n=300, true.model=true.model, 540 | fit.model="Y_O~X", targetparm="X", targetval=.5) 541 | result_3b 542 | ``` 543 | 544 | ## $targetval 545 | ## [1] 0.5 546 | ## 547 | ## $expected.b 548 | ## [1] 0.4999318 549 | ## 550 | ## $bias 551 | ## [1] -6.81728e-05 552 | ## 553 | ## $analytic.SE 554 | ## [1] 0.0646636 555 | ## 556 | ## $empirical.SE 557 | ## [1] 0.06623344 558 | ## 559 | ## $analytic.CI 560 | ## 2.5% 97.5% 561 | ## 0.3726767 0.6271870 562 | ## 563 | ## $empirical.CI 564 | ## 2.5% 97.5% 565 | ## 0.3755090 0.6346035 566 | ## 567 | ## $coverage 568 | ## [1] 0.946 569 | ## 570 | ## $RMSE 571 | ## [1] 0.06620036 572 | ## 573 | ## $adjustment.sets 574 | ## {} 575 | 576 | Plotting the results illustrates the unbiased estimation. 577 | 578 | ``` r 579 | plot(result_3b, type="perf", breaks=30) 580 | ``` 581 | 582 | ![](readme_files/figure-markdown_github/unnamed-chunk-34-1.png) 583 | -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-11_43c0bdea548234b13a40f454e5e67829.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-17_8e680a893ff0807f92d7fea5ef6f6029.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-19_e82ee92bd1e0c07d8ef66f5cd4db68dc.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-21_23292b8a6c3f3d1e76c15d1db89a67fd.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-22_a9ab600d42260b9b71e0c990ab337916.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-26_1de4b88b238c3a06c2e7b9dfc64b6a7a.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-27_928aba10d9f64f712c0b16700a2458cb.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-29_6786dcb442ab342e9563c90b387b4b21.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-31_c76f6c2688c3df3909e2c09c2a902946.rdx -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.RData -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.rdb -------------------------------------------------------------------------------- /readme_cache/latex/unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/latex/unnamed-chunk-33_3ccd52d739f4071974f56d7e3a6ddb17.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-12_ae409071df00265b132dbabb28e595ae.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-19_234877f42c56993fe06d9cc5dbac265f.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-21_c50f2c5d3ecdc374eb274e9a91e58c9f.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-26_c0d6389136b21e8a7a7e7a33cfddd86c.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-27_10857a1e884ad6a101fa19f3b3b6424e.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-27_6f8a0a4e4b640c57cda861398f7f811d.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-31_40d2c0e3794fa7eb402c58bf60672f40.rdx -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.RData -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.rdb -------------------------------------------------------------------------------- /readme_cache/markdown_github/unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_cache/markdown_github/unnamed-chunk-32_46cb1c81aac1b9cc4a2cdc737b5efaba.rdx -------------------------------------------------------------------------------- /readme_files/figure-html/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-html/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /readme_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /readme_files/figure-html/unnamed-chunk-17-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-html/unnamed-chunk-17-1.png -------------------------------------------------------------------------------- /readme_files/figure-html/unnamed-chunk-18-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-html/unnamed-chunk-18-1.png -------------------------------------------------------------------------------- /readme_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-12-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-12-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-15-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-15-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-18-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-18-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-20-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-20-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-23-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-23-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-25-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-25-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-26-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-26-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-27-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-27-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-30-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-30-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-31-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-31-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-34-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-34-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-latex/unnamed-chunk-4-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-latex/unnamed-chunk-4-1.pdf -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-16-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-16-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-17-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-17-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-18-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-18-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-26-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-26-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-28-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-29-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-29-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-30-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-30-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-31-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-31-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-33-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-33-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-33-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-33-2.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-33-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-33-3.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-34-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-34-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /readme_files/figure-markdown_github/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeem/regsim/5bec83040ea5d22231a32dffec898828f406c66e/readme_files/figure-markdown_github/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /tex/6192455f11190d8ed1eb8b18d3b6f8de.svg: -------------------------------------------------------------------------------- 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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /tex/de5d740af3fd4679ffc5d10a6e891286.svg: -------------------------------------------------------------------------------- 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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | --------------------------------------------------------------------------------