Learn R Programming

robustbetareg (version 0.3.1)

waldtypetest: Robust Wald-type Tests

Description

waldtypetest provides Wald-type tests for both simple and composite hypotheses for beta regression based on the robust estimators (LSMLE, LMDPDE, SMLE, and MDPDE).

Usage

waldtypetest(object, FUN, ...)

Value

waldtypetest returns an output for the Wald-type test containing the value of the test statistic, degrees-of-freedom and p-value.

Arguments

object

fitted model object of class robustbetareg (see robustbetareg).

FUN

function representing the null hypothesis to be tested.

...

further arguments to be passed to the FUN function.

Author

Yuri S. Maluf (yurimaluf@gmail.com), Francisco F. Queiroz (ffelipeq@outlook.com) and Silvia L. P. Ferrari.

Details

The function provides a robust Wald-type test for a general hypothesis \(m(\theta) = \eta_0\), for a fixed \(\eta_0 \in R^d\), against a two sided alternative; see Maluf et al. (2022) for details. The argument FUN specifies the function \(m(\theta) - \eta_0\), which defines the null hypothesis. For instance, consider a model with \(\theta = (\beta_1, \beta_2, \beta_3, \gamma_1)^\top\) and let the null hypothesis be \(\beta_2 + \beta_3 = 4\). The FUN argument can be FUN = function(theta) {theta[2] + theta[3] - 4}. It is also possible to define the function as FUN = function(theta, B) {theta[2] + theta[3] - B}, and pass the B argument through the waldtypetest function. If no function is specified, that is, FUN=NULL, the waldtypetest returns a test in which the null hypothesis is that all the coefficients are zero.

References

Maluf, Y.S., Ferrari, S.L.P., and Queiroz, F.F. (2022). Robust beta regression through the logit transformation. Metrika:61–81.

Basu, A., Ghosh, A., Martin, N., and Pardo, L. (2018). Robust Wald-type tests for non-homogeneous observations based on the minimum density power divergence estimator. Metrika, 81:493–522.

Ribeiro, K. A. T. and Ferrari, S. L. P. (2022). Robust estimation in beta regression via maximum Lq-likelihood. Statistical Papers.

See Also

robustbetareg

Examples

Run this code
# \donttest{
# generating a dataset
set.seed(2022)
n <- 40
beta.coef <- c(-1, -2)
gamma.coef <- c(5)
X <- cbind(rep(1, n), x <- runif(n))
mu <- exp(X%*%beta.coef)/(1 + exp(X%*%beta.coef))
phi <- exp(gamma.coef) #Inverse Log Link Function
y <- rbeta(n, mu*phi, (1 - mu)*phi)
y[26] <- rbeta(1, ((1 + mu[26])/2)*phi, (1 - ((1 + mu[26])/2))*phi)
SimData <- as.data.frame(cbind(y, x))
colnames(SimData) <- c("y", "x")

# Fitting the MLE and the LSMLE
fit.mle <- robustbetareg(y ~ x | 1, data = SimData, alpha = 0)
fit.lsmle <- robustbetareg(y ~ x | 1, data = SimData)

# Hypothesis to be tested: (beta_1, beta_2) = c(-1, -2) against a two
# sided alternative
h0 <- function(theta){theta[1:2] - c(-1, -2)}
waldtypetest(fit.mle, h0)
waldtypetest(fit.lsmle, h0)
# Alternative way:
h0 <- function(theta, B){theta[1:2] - B}
waldtypetest(fit.mle, h0, B = c(-1, -2))
waldtypetest(fit.lsmle, h0, B = c(-1, -2))
# }

Run the code above in your browser using DataLab