regsim simulates quantities of interest from regression models

regsim(object, x, num = 1000, ...)

Arguments

object

a regression model, usually, a result of a call to lm or glm

x

a list of explanatory variables

num

number of iterations to run

...

additional arguments passed to class-specific functions

Examples

library(regsim) model <- lm(mpg ~ wt + cyl, data = mtcars) x <- list(wt = seq(1, 5, 0.1)) sim <- regsim(model, x) summary(sim)
#> Profile 1 #> wt 1.0000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p1 23.75725 27.05261 30.61874 #> ----------------------------- #> #> Profile 2 #> wt 1.1000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p2 23.56881 26.74845 30.15168 #> ----------------------------- #> #> Profile 3 #> wt 1.2000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p3 23.38532 26.43346 29.6959 #> ---------------------------- #> #> Profile 4 #> wt 1.3000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p4 23.21381 26.11135 29.25523 #> ----------------------------- #> #> Profile 5 #> wt 1.4000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p5 23.05203 25.80807 28.82608 #> ----------------------------- #> #> Profile 6 #> wt 1.5000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p6 22.88363 25.49898 28.39346 #> ----------------------------- #> #> Profile 7 #> wt 1.6000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p7 22.6852 25.17973 27.89615 #> ---------------------------- #> #> Profile 8 #> wt 1.7000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p8 22.46842 24.87928 27.44531 #> ----------------------------- #> #> Profile 9 #> wt 1.8000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p9 22.29301 24.56336 26.96653 #> ----------------------------- #> #> Profile 10 #> wt 1.9000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p10 22.09614 24.24425 26.48575 #> ------------------------------ #> #> Profile 11 #> wt 2.0000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p11 21.87351 23.93417 25.98696 #> ------------------------------ #> #> Profile 12 #> wt 2.1000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p12 21.68722 23.62267 25.51672 #> ------------------------------ #> #> Profile 13 #> wt 2.2000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p13 21.51039 23.30848 25.05096 #> ------------------------------ #> #> Profile 14 #> wt 2.3000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p14 21.31079 23.00193 24.61588 #> ------------------------------ #> #> Profile 15 #> wt 2.4000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p15 21.12607 22.67654 24.25461 #> ------------------------------ #> #> Profile 16 #> wt 2.5000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p16 20.93417 22.3535 23.78584 #> ----------------------------- #> #> Profile 17 #> wt 2.6000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p17 20.74579 22.03754 23.31205 #> ------------------------------ #> #> Profile 18 #> wt 2.7000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p18 20.5159 21.71519 22.92602 #> ----------------------------- #> #> Profile 19 #> wt 2.8000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p19 20.30651 21.40468 22.48858 #> ------------------------------ #> #> Profile 20 #> wt 2.9000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p20 20.06388 21.09085 22.08203 #> ------------------------------ #> #> Profile 21 #> wt 3.0000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p21 19.81815 20.77105 21.71551 #> ------------------------------ #> #> Profile 22 #> wt 3.1000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p22 19.54367 20.459 21.36041 #> ---------------------------- #> #> Profile 23 #> wt 3.2000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p23 19.26848 20.14253 21.04901 #> ------------------------------ #> #> Profile 24 #> wt 3.3000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p24 18.93334 19.8163 20.73926 #> ----------------------------- #> #> Profile 25 #> wt 3.4000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p25 18.58265 19.50478 20.42886 #> ------------------------------ #> #> Profile 26 #> wt 3.5000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p26 18.19921 19.20583 20.14163 #> ------------------------------ #> #> Profile 27 #> wt 3.6000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p27 17.80725 18.88233 19.86312 #> ------------------------------ #> #> Profile 28 #> wt 3.7000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p28 17.38701 18.56544 19.64015 #> ------------------------------ #> #> Profile 29 #> wt 3.8000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p29 17.00329 18.25433 19.44798 #> ------------------------------ #> #> Profile 30 #> wt 3.9000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p30 16.59389 17.94466 19.21946 #> ------------------------------ #> #> Profile 31 #> wt 4.0000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p31 16.16702 17.63336 19.01959 #> ------------------------------ #> #> Profile 32 #> wt 4.1000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p32 15.70341 17.31642 18.80502 #> ------------------------------ #> #> Profile 33 #> wt 4.2000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p33 15.26725 17.01831 18.61819 #> ------------------------------ #> #> Profile 34 #> wt 4.3000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p34 14.82735 16.70703 18.41602 #> ------------------------------ #> #> Profile 35 #> wt 4.4000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p35 14.35598 16.39347 18.23204 #> ------------------------------ #> #> Profile 36 #> wt 4.5000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p36 13.90282 16.07334 18.06832 #> ------------------------------ #> #> Profile 37 #> wt 4.6000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p37 13.45012 15.75734 17.91078 #> ------------------------------ #> #> Profile 38 #> wt 4.7000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p38 12.99756 15.44329 17.77738 #> ------------------------------ #> #> Profile 39 #> wt 4.8000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p39 12.54283 15.13455 17.59156 #> ------------------------------ #> #> Profile 40 #> wt 4.9000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p40 12.08878 14.82278 17.42779 #> ------------------------------ #> #> Profile 41 #> wt 5.0000 #> cyl 6.1875 #> #> 2.5% 50% 97.5% #> p41 11.63521 14.51413 17.26673 #> ------------------------------ #>