https://github.com/cran/Hmisc
Revision 3a9da9f99a8b5e7ac4dcd58e6f5c939486b62b91 authored by Frank E Harrell Jr on 02 May 2016, 17:28:19 UTC, committed by cran-robot on 02 May 2016, 17:28:19 UTC
1 parent 20cfb9a
Raw File
Tip revision: 3a9da9f99a8b5e7ac4dcd58e6f5c939486b62b91 authored by Frank E Harrell Jr on 02 May 2016, 17:28:19 UTC
version 3.17-4
Tip revision: 3a9da9f
aregImpute3.r
require(Hmisc)
n <- 100
set.seed(1)
y <- sample(0:8, n, TRUE)
x1 <- runif(n)
x2 <- runif(n)
x2[1:10] <- NA
z <- sample(1:20, n, TRUE)
d <- data.frame(y, x1, x2, z)
f1 <- glm(y ~ x1 + x2, family=poisson)
f2 <- glm(y ~ x1 + x2 + offset(log(z)), family=poisson)

a <- aregImpute(~ y + x1 + x2)
g1 <- fit.mult.impute(y ~ x1 + x2 , glm, a,
	family=poisson, data=d)
g2 <- fit.mult.impute(y ~ x1 + x2 + offset(log(z)), glm, a,
	family=poisson, data=d)
# g3 <- fit.mult.impute(y ~ x1 + x2 + offset(log(z)), Glm, a, family=poisson, data=d)
coef(g1)
coef(g2)
# coef(g3)
coef(f1)
coef(f2)

back to top