Given a design matrix, as generated by the design.des function, the design.dat function appends (1) fitted values on the response scale (“fitted”), (2) the delta method standard error for the fitted value (“se”), (3) the lower limit of a confidence interval around the fitted value (“ll”), and the upper limit of a confidence interval around the fitted value (“ul”).
For example:
library(catregs)
data("Mize19AH")
m1 <- glm(alcB ~woman*parrole + age + race2 + race3 + race4 + income + ed1 + ed2 + ed3 + ed4,family="binomial",data=Mize19AH)
des2<-margins.des(m1,expand.grid(woman=c(0,1),parrole=c(0,1)))
margins.dat(m1,des2,rounded=5)##   woman parrole      age   race2  race3   race4   income    ed1     ed2     ed3
## 1     0       0 28.41653 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 2     1       0 28.41653 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 3     0       1 28.41653 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 4     1       1 28.41653 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
##       ed4  fitted      se      ll      ul
## 1 0.09775 0.72071 0.01277 0.69567 0.74574
## 2 0.09775 0.66015 0.01556 0.62966 0.69065
## 3 0.09775 0.61450 0.02024 0.57483 0.65416
## 4 0.09775 0.49175 0.01470 0.46293 0.52056##   parrole woman      age   race2  race3   race4   income    ed1     ed2     ed3
## 1       1     1 28.41653 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 2       1     1 28.41653 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 3       1     1 28.41653 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
##       ed4  fitted     se      ll      ul
## 1 0.09775 0.49175 0.0147 0.46293 0.52056
## 2 0.09775      NA     NA      NA      NA
## 3 0.09775 0.49175 0.0147 0.46293 0.52056des3 <- margins.des(m1,expand.grid(age=seq(20,75,5),parrole=c(0,1)))
a<- margins.dat(m1,des3,rounded=5)
a##    age parrole   woman   race2  race3   race4   income    ed1     ed2     ed3
## 1   20       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 2   25       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 3   30       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 4   35       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 5   40       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 6   45       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 7   50       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 8   55       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 9   60       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 10  65       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 11  70       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 12  75       0 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 13  20       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 14  25       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 15  30       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 16  35       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 17  40       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 18  45       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 19  50       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 20  55       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 21  60       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 22  65       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 23  70       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
## 24  75       1 0.54748 0.21895 0.0058 0.02995 34.50605 0.1811 0.41003 0.25424
##        ed4  fitted      se       ll      ul
## 1  0.09775 0.82016 0.02367  0.77376 0.86656
## 2  0.09775 0.74777 0.01437  0.71961 0.77593
## 3  0.09775 0.65839 0.01302  0.63286 0.68391
## 4  0.09775 0.55613 0.03349  0.49048 0.62177
## 5  0.09775 0.44888 0.05585  0.33941 0.55835
## 6  0.09775 0.34618 0.07195  0.20516 0.48720
## 7  0.09775 0.25606 0.07823  0.10274 0.40939
## 8  0.09775 0.18285 0.07526  0.03534 0.33036
## 9  0.09775 0.12699 0.06618 -0.00272 0.25670
## 10 0.09775 0.08639 0.05448 -0.02039 0.19317
## 11 0.09775 0.05791 0.04275 -0.02588 0.14171
## 12 0.09775 0.03843 0.03241 -0.02509 0.10194
## 13 0.09775 0.71460 0.03507  0.64586 0.78335
## 14 0.09775 0.61944 0.02042  0.57943 0.65946
## 15 0.09775 0.51413 0.01353  0.48760 0.54065
## 16 0.09775 0.40754 0.03042  0.34791 0.46717
## 17 0.09775 0.30900 0.04596  0.21893 0.39908
## 18 0.09775 0.22523 0.05358  0.12021 0.33025
## 19 0.09775 0.15894 0.05343  0.05422 0.26367
## 20 0.09775 0.10941 0.04801  0.01532 0.20351
## 21 0.09775 0.07396 0.04012 -0.00468 0.15260
## 22 0.09775 0.04936 0.03186 -0.01310 0.11181
## 23 0.09775 0.03265 0.02440 -0.01517 0.08047
## 24 0.09775 0.02147 0.01819 -0.01418 0.05712