Skip to content
Back to formatted view

Raw Message

Message-ID: <A5A30F1D451F924B902DDE8063410E670EB899@EM1A.ad.ucla.edu>
Date: 2016-06-13T17:45:49Z
From: Ganz, Carl
Subject: Using weights with truncreg

Hello everyone,

I would like to use truncreg on survey data with weights, but so far as I can tell the weight parameter in truncreg is not working. I find that using weights does not actually change the output.

Here is a small reproducible example using the example in the documentation:

## simulate a data.frame
set.seed(1071)
n <- 10000
sigma <- 4
alpha <- 2
beta <- 1
x <- rnorm(n, mean = 0, sd = 2)
eps <- rnorm(n, sd = sigma)
y <- alpha + beta * x + eps
d <- data.frame(y = y, x = x)

## truncated response
d$yt <- ifelse(d$y > 1, d$y, NA)

## binary threshold response
d$yb <- factor(d$y > 0)

## censored response
d$yc <- pmax(1, d$y)

## random weight
wgt <- runif(10000,500,1500)
## unweighted
fm_trunc <- truncreg(yt ~ x, data = d, point = 1, direction = "left")
## weighted
fm_trunc_weighted <- truncreg(yt ~ x, data = d, weights = wgt, point = 1, direction = "left")

coef(fm_trunc_weighted)==coef(fm_trunc) # all equal

Am I misunderstanding how the weight parameter works for truncreg or is the weight parameter not working?

Kind Regards,
Carl

	[[alternative HTML version deleted]]