abso_diff_est {quantoptr} | R Documentation |
Estimate the Gini's mean difference/mean absolute difference(MAD) for a Given Treatment Regime
Description
Estimate the MAD if the entire population follows a
treatment regime indexed by the given parameters.
This function supports the IPWE_MADopt
function.
Usage
abso_diff_est(beta, x, y, a, prob, Cnobs)
Arguments
beta |
a vector indexing the treatment regime. It indexes a linear treatment regime:
|
x |
a matrix of observed covariates from the sample.
Notice that we assumed the class of treatment regimes is linear.
This is important that columns in |
y |
a vector, the observed responses from a sample |
a |
a vector of 0s and 1s, the observed treatments from a sample |
prob |
a vector, the propensity scores of getting treatment 1 in the samples |
Cnobs |
A matrix with two columns, enumerating all possible combinations of
pairs of indexes. This can be generated by |
References
Wang L, Zhou Y, Song R and Sherwood B (2017). “Quantile-Optimal Treatment Regimes.” Journal of the American Statistical Association.
See Also
The function IPWE_MADopt
is based on this function.
Examples
library(stats)
GenerateData.MAD <- function(n)
{
x1 <- runif(n)
x2 <- runif(n)
tp <- exp(-1+1*(x1+x2))/(1+exp(-1+1*(x1+x2)))
a<-rbinom(n = n, size = 1, prob=tp)
error <- rnorm(length(x1))
y <- (1 + a*0.3*(-1+x1+x2<0) + a*-0.3*(-1+x1+x2>0)) * error
return(data.frame(x1=x1,x2=x2,a=a,y=y))
}
n <- 500
testData <- GenerateData.MAD(n)
logistic.model.tx <- glm(formula = a~x1+x2, data = testData, family=binomial)
ph <- as.vector(logistic.model.tx$fit)
Cnobs <- combn(1:n, 2)
abso_diff_est(beta=c(1,2,-1),
x=model.matrix(a~x1+x2, testData),
y=testData$y,
a=testData$a,
prob=ph,
Cnobs = Cnobs)