Running examples in ‘ipw-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: ipwpoint
> ### Title: Estimate Inverse Probability Weights (Point Treatment)
> ### Aliases: ipwpoint
> ### Keywords: htest models
> 
> ### ** Examples
> 
> #Simulate data with continuous confounder and outcome, binomial exposure.
> #Marginal causal effect of exposure on outcome: 10.
> n <- 1000
> simdat <- data.frame(l = rnorm(n, 10, 5))
> a.lin <- simdat$l - 10
> pa <- exp(a.lin)/(1 + exp(a.lin))
> simdat$a <- rbinom(n, 1, prob = pa)
> simdat$y <- 10*simdat$a + 0.5*simdat$l + rnorm(n, -10, 5)
> simdat[1:5,]
          l a         y
1  6.867731 0 -2.315917
2 10.918217 0 -9.167457
3  5.821857 0 -2.621165
4 17.976404 1  4.283153
5 11.647539 1  8.518530
> 
> #Estimate ipw weights.
> temp <- ipwpoint(
+    exposure = a,
+    family = "binomial",
+    link = "logit",
+    numerator = ~ 1,
+    denominator = ~ l,
+    data = simdat)
> summary(temp$ipw.weights)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.4950  0.5050  0.5163  0.8904  0.6100 89.0982 
> 
> #Plot inverse probability weights
> graphics.off()
> ipwplot(weights = temp$ipw.weights, logscale = FALSE,
+    main = "Stabilized weights", xlim = c(0, 8))
> 
> #Examine numerator and denominator models.
> summary(temp$num.mod)

Call:
glm(formula = a ~ 1, family = "logit", data = simdat, na.action = na.fail)

Coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept)  0.02000    0.06325   0.316    0.752

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 1386.2  on 999  degrees of freedom
Residual deviance: 1386.2  on 999  degrees of freedom
AIC: 1388.2

Number of Fisher Scoring iterations: 3

> summary(temp$den.mod)

Call:
glm(formula = a ~ l, family = "logit", data = simdat, na.action = na.fail)

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
(Intercept) -10.08091    0.71644  -14.07   <2e-16 ***
l             1.02239    0.07202   14.20   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 1386.19  on 999  degrees of freedom
Residual deviance:  464.46  on 998  degrees of freedom
AIC: 468.46

Number of Fisher Scoring iterations: 7

> 
> #Paste inverse probability weights
> simdat$sw <- temp$ipw.weights
> 
> #Marginal structural model for the causal effect of a on y
> #corrected for confounding by l using inverse probability weighting
> #with robust standard error from the survey package.
> require("survey")
Loading required package: survey
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘survey’
> msm <- (svyglm(y ~ a, design = svydesign(~ 1, weights = ~ sw,
+    data = simdat)))
Error in svyglm(y ~ a, design = svydesign(~1, weights = ~sw, data = simdat)) : 
  could not find function "svyglm"
Execution halted