betaor: Odds ratios for a beta regression.

Description Usage Arguments Details Value References See Also Examples

View source: R/betaor.R

Description

This function estimates a beta regression model and calculates the corresponding odds ratios.

Usage

1
2
betaor(formula, data, robust = FALSE, clustervar1 = NULL, clustervar2 = NULL, 
       control = betareg.control(), link.phi = NULL, type = "ML")

Arguments

formula

an object of class “formula” (or one that can be coerced to that class).

data

the data frame containing these data. This argument must be used.

robust

if TRUE the function reports White/robust standard errors.

clustervar1

a character value naming the first cluster on which to adjust the standard errors.

clustervar2

a character value naming the second cluster on which to adjust the standard errors for two-way clustering.

control

a list of control arguments specified via betareg.control.

link.phi

as in the betareg function.

type

as in the betareg function.

Details

The underlying link function in the mean model (mu) is "logit". If both robust=TRUE and !is.null(clustervar1) the function overrides the robust command and computes clustered standard errors.

Value

oddsratio

a coefficient matrix with columns containing the estimates, associated standard errors, test statistics and p-values.

fit

the fitted betareg object.

call

the matched call.

References

Francisco Cribari-Neto, Achim Zeileis (2010). Beta Regression in R. Journal of Statistical Software 34(2), 1-24.

Bettina Gruen, Ioannis Kosmidis, Achim Zeileis (2012). Extended Beta Regression in R: Shaken, Stirred, Mixed, and Partitioned. Journal of Statistical Software, 48(11), 1-25.

See Also

betamfx, betareg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# simulate some data
set.seed(12345)
n = 1000
x = rnorm(n)

# beta outcome
y = rbeta(n, shape1 = plogis(1 + 0.5 * x), shape2 = (abs(0.2*x)))
# use Smithson and Verkuilen correction
y = (y*(n-1)+0.5)/n

data = data.frame(y,x)
betaor(y~x|x, data=data)

Example output

Loading required package: sandwich
Loading required package: lmtest
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: MASS
Loading required package: betareg
Call:
betaor(formula = y ~ x | x, data = data)

Odds Ratio:
  OddsRatio Std. Err.      z    P>|z|   
x  1.149663  0.056905 2.8177 0.004837 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

mfx documentation built on May 2, 2019, 12:46 p.m.