The betareg Package. October 6, 2006

Similar documents
Generalized Linear Models

14 Multiple Linear Regression

Generalized linear models

STAT 510 Final Exam Spring 2015

LOGISTIC REGRESSION Joseph M. Hilbe

7/28/15. Review Homework. Overview. Lecture 6: Logistic Regression Analysis

epub WU Institutional Repository

Introduction to General and Generalized Linear Models

Regression models. Generalized linear models in R. Normal regression models are not always appropriate. Generalized linear models. Examples.

Package dispmod. March 17, 2018

Chapter 1. Modeling Basics

Introduction to General and Generalized Linear Models

Tento projekt je spolufinancován Evropským sociálním fondem a Státním rozpočtem ČR InoBio CZ.1.07/2.2.00/

Linear, Generalized Linear, and Mixed-Effects Models in R. Linear and Generalized Linear Models in R Topics

Package HGLMMM for Hierarchical Generalized Linear Models

A Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn

Generalized Linear. Mixed Models. Methods and Applications. Modern Concepts, Walter W. Stroup. Texts in Statistical Science.

Generalized linear models for binary data. A better graphical exploratory data analysis. The simple linear logistic regression model

Classification. Chapter Introduction. 6.2 The Bayes classifier

Package sklarsomega. May 24, 2018

Logistic Regression. 1 Analysis of the budworm moth data 1. 2 Estimates and confidence intervals for the parameters 2

EPSY 905: Fundamentals of Multivariate Modeling Online Lecture #7

Logistic Regression - problem 6.14

1. Hypothesis testing through analysis of deviance. 3. Model & variable selection - stepwise aproaches

R Hints for Chapter 10

M. H. Gonçalves 1 M. S. Cabral 2 A. Azzalini 3

Two Hours. Mathematical formula books and statistical tables are to be provided THE UNIVERSITY OF MANCHESTER. 26 May :00 16:00

Class Notes: Week 8. Probit versus Logit Link Functions and Count Data

Regression Analysis and Forecasting Prof. Shalabh Department of Mathematics and Statistics Indian Institute of Technology-Kanpur

Review: what is a linear model. Y = β 0 + β 1 X 1 + β 2 X 2 + A model of the following form:

Chapter 1 Statistical Inference

The nltm Package. July 24, 2006

Linear Regression. Data Model. β, σ 2. Process Model. ,V β. ,s 2. s 1. Parameter Model

Hands on cusp package tutorial

Sta s cal Models: Day 3

STATISTICS 110/201 PRACTICE FINAL EXAM

cor(dataset$measurement1, dataset$measurement2, method= pearson ) cor.test(datavector1, datavector2, method= pearson )

The R-Function regr and Package regr0 for an Augmented Regression Analysis

This manual is Copyright 1997 Gary W. Oehlert and Christopher Bingham, all rights reserved.

Introduction to Regression

Package clogitboost. R topics documented: December 21, 2015

Generalised linear models. Response variable can take a number of different formats

Stat 231 Final Exam Fall 2011

Package mistwosources

Experimental Design and Statistical Methods. Workshop LOGISTIC REGRESSION. Jesús Piedrafita Arilla.

Topic 20: Single Factor Analysis of Variance

The sbgcop Package. March 9, 2007

A Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn

Exam Applied Statistical Regression. Good Luck!

Introduction and Single Predictor Regression. Correlation

A NOTE ON ROBUST ESTIMATION IN LOGISTIC REGRESSION MODEL

Multivariate Statistics in Ecology and Quantitative Genetics Summary

Package zoib. October 18, 2016

Generating Half-normal Plot for Zero-inflated Binomial Regression

CLUSTER WEIGHTED BETA REGRESSION

Generalized Linear Models

11. Generalized Linear Models: An Introduction

Binary Regression. GH Chapter 5, ISL Chapter 4. January 31, 2017

Package leiv. R topics documented: February 20, Version Type Package

UNIVERSITY OF TORONTO Faculty of Arts and Science

Package sbgcop. May 29, 2018

Description Syntax for predict Menu for predict Options for predict Remarks and examples Methods and formulas References Also see

Non-Gaussian Response Variables

Linear Regression Models P8111

Model Based Statistics in Biology. Part V. The Generalized Linear Model. Chapter 18.1 Logistic Regression (Dose - Response)

Package dispmod. R topics documented: February 15, Version 1.1. Date Title Dispersion models

POLSCI 702 Non-Normality and Heteroskedasticity

Package svydiags. June 4, 2015

Hypothesis Testing for Var-Cov Components

Advanced Quantitative Data Analysis

Week 8: Correlation and Regression

Homework Solutions Applied Logistic Regression

Package anoint. July 19, 2015

Lab 3: Two levels Poisson models (taken from Multilevel and Longitudinal Modeling Using Stata, p )

Package SimCorMultRes

Multilevel Models in Matrix Form. Lecture 7 July 27, 2011 Advanced Multivariate Statistical Methods ICPSR Summer Session #2

Stat 411/511 ESTIMATING THE SLOPE AND INTERCEPT. Charlotte Wickham. stat511.cwick.co.nz. Nov

Location-adjusted Wald statistics

Package ARCensReg. September 11, 2016

Week 7 Multiple factors. Ch , Some miscellaneous parts

BOOtstrapping the Generalized Linear Model. Link to the last RSS article here:factor Analysis with Binary items: A quick review with examples. -- Ed.

Sleep data, two drugs Ch13.xls

Statistical Modelling in Stata 5: Linear Models

Statistics - Lecture Three. Linear Models. Charlotte Wickham 1.

Generalized Linear Models: An Introduction

Topic 17 - Single Factor Analysis of Variance. Outline. One-way ANOVA. The Data / Notation. One way ANOVA Cell means model Factor effects model

Stat 579: Generalized Linear Models and Extensions

Notes for week 4 (part 2)

ECLT 5810 Linear Regression and Logistic Regression for Classification. Prof. Wai Lam

R Output for Linear Models using functions lm(), gls() & glm()

Regression: Main Ideas Setting: Quantitative outcome with a quantitative explanatory variable. Example, cont.

Package msir. R topics documented: April 7, Type Package Version Date Title Model-Based Sliced Inverse Regression

Log-linear Models for Contingency Tables

Package gcmr. R topics documented: April 30, 2018

Introduction to Regression in R Part II: Multivariate Linear Regression

The Model Building Process Part I: Checking Model Assumptions Best Practice (Version 1.1)

Linear regression and correlation

8 Nominal and Ordinal Logistic Regression

SCHOOL OF MATHEMATICS AND STATISTICS. Linear and Generalised Linear Models

The First Thing You Ever Do When Receive a Set of Data Is

Transcription:

The betareg Package October 6, 2006 Title Beta Regression. Version 1.2 Author Alexandre de Bustamante Simas <alesimas@impa.br>, with contributions, in this last version, from Andréa Vanessa Rocha <andrea@cox.de.ufpe.br> Beta regression for modeling rates and proportions. Maintainer Alexandre de Bustamante Simas <alesimas@impa.br> License GPL R topics documented: anova.betareg........................................ 2 betareg............................................ 3 br.fit............................................. 4 cooks.distance.betareg................................... 5 df.residual.betareg...................................... 6 envelope.beta........................................ 6 estfun.betareg........................................ 7 gen.lev.betareg....................................... 8 hatvalues.betareg...................................... 9 loglik.betareg........................................ 10 plot.betareg......................................... 11 prater............................................ 12 pratergrouped........................................ 13 predict.betareg....................................... 14 residuals.betareg...................................... 15 summary.betareg...................................... 16 vcov.betareg......................................... 17 Index 18 1

2 anova.betareg anova.betareg A preliminary version for the analisys of variance table Compute an analysis of variance table for one or two model fits. anova.betareg(object, object2,...) object object2 a fitted model using betareg, if there are two models, then this model should be the restricted one (optional) a fitted model using betareg... further arguments passed to or from other methods. If object2 is missing, an anova table is produced considering the null that the model contain only the intercept. If object2 isn t missing (i.e., a restricted model was placed), an anova table is produced considering the null that the second model is true. This "anova table" is constructed using the log-likelihood ratio test suggest by Ferrari and Cribari-Neto (2004). Andréa Vanessa Rocha (andrea@cox.de.ufpe.br) contributed in the development of this function. br.fit, summary.betareg, predict.betareg, residuals.betareg fit1 <- betareg(oil ~ batch1 + batch2 + batch3 + batch4 + batch5 + fit2 <- betareg(oil ~ batch1 + batch2 + temp, data=pratergrouped) ## With only one model anova(fit1) ## With two models, note that the first model is the restricted one. anova(fit2,fit1)

betareg 3 betareg Fitting beta regression models betareg is used to fit a regression model where the response is beta distributed using a parameterization of the beta law that is indexed by mean and dispersion parameters. betareg(formula, link = "logit", data) formula link data a symbolic description of the model to be fit: response covariates. a link function; the following links are available: logit, probit and cloglog. The default link function is logit. the data argument : a data frame containing the data. Details The model is useful for situations where the variable of interest is continuous, restricted to the standard unit interval (0,1), and related to other variables through a regression structure. The regression parameters of the beta regression model are interpretable in terms of the mean of the response and, when the logit link is used, of an odds ratio, unlike the parameters of a linear regression that employs a transformed response. Estimation is performed by maximum likelihood. The log-likelihood function is maximized using the quasi-newton BFGS algorithm with analytical first derivatives; the choice of initial values follows the proposal made by Ferrari and Cribari-Neto (2004). The function returns an object of class betareg or lm. The function summary is used to obtain an estimate of the precision parameter (phi), and the pseudo R2 value. br.fit, summary.betareg, predict.betareg, residuals.betareg

4 br.fit fit1 <- betareg(oil ~ batch1 + batch2 + batch3 + batch4 + batch5 + fit2 <- betareg(oil ~ batch1 + batch2 + batch3 + batch4 + batch5 + batch6 + batch7 + batch8 + batch9 + temp, link = "probit", data=pratergrouped) summary(fit1) par(mfrow=c(2,2)) plot(fit1) br.fit Function to estimate the coefficients of the Beta Regression. Function to estimate the coefficients of the Beta Regression. br.fit(x, y, link) x y link the terms matrix the response matrix an object returned by the make.link function. The function returns the estimated coefficients of the regression, the estimation of the precision parameter phi, the fitted values, the residuals,the pseudo R2, the standard errors, the critical values of the normal distribution and the p-values of each coefficient and the phi parameter. betareg, summary.betareg, predict.betareg, residuals.betareg x <- cbind(rnorm(10),rnorm(10)) y <- cbind(rbeta(10,1,1)) link = betareg(y ~ x)$funlink br.fit(x,y,link)

cooks.distance.betareg 5 cooks.distance.betareg Cook s distance values Compute the Cook s distance values for beta regression models. cooks.distance.betareg(model,...) model a fitted model using betareg.... further arguments passed to or from other methods. This function returns a vector containing the Cook s distance values. COOK, R. D. and WEISBERG, S. (1982) Residuals and Influence in Regression. London: Chapman and Hall. br.fit, summary.betareg, predict.betareg, residuals.betareg cooks.distance(fit)

6 envelope.beta df.residual.betareg Residual Degrees-of-Freedom Returns the residual degrees-of-freedom extracted from a fitted betareg model object. df.residual.betareg(object,...) object an object for which the degrees-of-freedom are desired.... further arguments passed to or from other methods. The value of the residual degrees-of-freedom extracted from the object x. br.fit, summary.betareg, predict.betareg, residuals.betareg df.residual(fit) envelope.beta Half-Normal Plot of Standardized and Deviance Residuals Two plots are provided together with an envelope: A Half-Normal plot of standardized residuals and a Half-Normal plot of deviance residuals. envelope.beta(model=fit.model,sim=100,conf=.90, pch="+",font.main=1, cex.main=1.5, type = c("standardized","deviance"))

estfun.betareg 7 model sim conf Fitted model using betareg The number of simulations used to produce the confidence bounds The confidence level pch Determines if the points are presented as "+" or "-" font.main cex.main type Determines the type of the font in the main title The size of the font in the main title Determines if the type of the residual is "standardized" or "deviance" This function was made by Elias Krainski. betareg, summary.betareg, predict.betareg, residuals.betareg envelope.beta(fit) estfun.betareg Extract Empirical Estimating Functions Function for extracting the empirical estimating functions of a betareg fitted model. estfun.betareg(x,...) x a fitted model using betareg.... further arguments passed to or from other methods. A matrix containing the empirical estimating functions. Typically, this should be an n x k matrix corresponding to n observations and k parameters. The columns should be named as in coef or terms, respectively.

8 gen.lev.betareg This function was made by Achim Zeileis. ZEILEIS, A. (2006). Object-oriented Computation of Sandwich Estimators. Package vignette. br.fit, summary.betareg, predict.betareg, residuals.betareg estfun.betareg(fit) gen.lev.betareg Generalized leverage values Compute the generalized leverages values for beta regression models. gen.lev.betareg(x,...) x a fitted model using betareg.... further arguments passed to or from other methods. This function returns a vector containing the generalized leverage values. The generalized leverage was proposed by Wei, Hu and Fung and was adapted to the beta regression model by Ferrari and Cribari-Neto (2004). WEI, B.-C., HU, Y.-Q. and FUNG, W.-K. (1998). Generalized leverage and its applications. Scandinavian Journal of Statistics, 25, 25-37

hatvalues.betareg 9 br.fit, summary.betareg, predict.betareg, residuals.betareg gen.lev.betareg(fit) hatvalues.betareg Hat values Compute the diagonal elements of the "Hat" matrix of a beta regression model. hatvalues.betareg(model,...) model a fitted model using betareg.... further arguments passed to or from other methods. This function returns a vector containing the diagonal elements of the "hat" matrix. br.fit, summary.betareg, predict.betareg, residuals.betareg hatvalues(fit)

10 loglik.betareg loglik.betareg Extract Log-Likelihood Obtain the log-likelihood value of a fitted betareg model. loglik.betareg(object,...) object a fitted model using betareg.... further arguments passed to or from other methods. Returns the log-likehood value of the model together with the number of parameters. br.fit, summary.betareg, predict.betareg, residuals.betareg loglik(fit)

plot.betareg 11 plot.betareg Plot Diagnostics for an betareg Object This function returns four plots: a plot of residuals against fitted values, a plot of standardized residuals against fitted values, a generalized leverage plot against fitted values and a plot of Cook s distances versus row labels. plot.betareg(x, which = 1:4, caption = c("deviance residuals vs indices of obs." "Standardized residuals vs indices of obs.", "Generalized leverage vs. Predi panel = points, sub.caption = deparse(x$call), main = "", ask = prod(par("mfcol")) < length(which) && dev.interactive(),..., id.n = 3, labels.id = names(residuals(x)), cex.id = 0.75) x Fitted model by betareg. which If a subset of the plots is required, specify a subset of the numbers 1:4. caption panel sub.caption main ask Captions to appear above the plots. Panel function. A useful alternative to points is panel.smooth. common title-above figures if there are multiple; used as sub (s. title ) otherwise. title to each plot-in addition to the above caption. logical; if TRUE, the user is asked before each plot, see par(ask=.).... optional arguments. id.n labels.id cex.id number of points to be labelled in each plot, starting with the most extreme. vector of labels, from which the labels for extreme points will be chosen. NULL uses observation numbers. magnification of point labels. betareg, br.fit, predict.betareg, residuals.betareg

12 prater plot(fit) prater Prater s gasoline data Operational data of the proportion of crude oil converted to gasoline after distilation and fractionation. data(prater) Format A data frame with 32 observations on 5 variables. [,1] oil The proportion of crude oil converted to gasoline after distilation and fractionation. [,2] apigrav The crude oil gravity (degrees API). [,3] vaporpress The vapor pressure of the crude oil (lbf/in2 ). [,4] tempten The crude oil 10 [,5] temp The temperature (degrees F) at which all the gasoline is vaporized. Details This dataset was collected by Prater (1956), its dependent variable is the proportion of crude oil after distilation and fractionation. This dataset was analyzed by Atkunson (1985), who used the linear regression model and noted that there is indication that the error distribution is not quite symmetrical, giving rise to some unduly large and small residuals (p. 60). Source Prater, N.H. (1956). Estimate gasoline yields from crudes. New York: Springer-Verlag. Atkinson, A.C. (1985). Plots, Transformations and Regression: An Introduction to Graphical Methods of Diagnostic Regression Analysis. New York: Oxford University Press. data(prater) fit <- betareg(oil ~ apigrav + vaporpress + tempten + temp, data=prater) plot(fit)

pratergrouped 13 pratergrouped Grouped Prater s gasoline data Operational data of the proportion of crude oil converted to gasoline after distilation and fractionation. Format A data frame with 32 observations on 11 variables. More details on the independent variables can be found in the details section below. [,1] oil The proportion of crude oil converted to gasoline after distilation and fractionation. [,2] batch1 The first batch of crude oil. [,3] batch2 The second batch of crude oil. [,4] batch3 The third batch of crude oil. [,5] batch4 The fourth batch of crude oil. [,6] batch5 The fifth batch of crude oil. [,7] batch6 The sixth batch of crude oil. [,8] batch7 The seventh batch of crude oil. [,9] batch8 The eighth batch of crude oil. [,10] batch9 The ninth batch of crude oil. [,11] temp The temperature (degrees F) at which all the gasoline is vaporized. Details The dataset contains 32 observations on the response and on the independent variables. It has been noted (Daniel and Wood, 1971, Ch. 8) that there are only ten sets of values of the first three explanatory variables which correspond to ten different crudes and were subjected to experimentally controlled distilation conditions. This dataset was analyzed by Atkinson (1985), who used the linear regression model and noted that there is indication that the error distribution is not quite symmetrical, giving rise to some unduly large and small residuals (p. 60). He proceeded to transform the response so that the transformed dependent variable assumed values on the real line, and then used it in a linear regression analysis. The data were ordered according to the ascending order of the covariate that measures the temperature at which 10 Source Prater, N.H. (1956). Estimate gasoline yields from crudes. New York: Springer-Verlag. Atkinson, A.C. (1985). Plots, Transformations and Regression: An Introduction to Graphical Methods of Diagnostic Regression Analysis. New York: Oxford University Press. Daniel, C. and Wood, F.S. (1971). Fitting Equations to Data. New York: Wiley

14 predict.betareg fit1 <- betareg(oil ~ batch1 + batch2 + batch3 + batch4 + batch5 + fit2 <- betareg(oil ~ batch1 + batch2 + batch3 + batch4 + batch5 + batch6 + batch7 + batch8 + batch9 + temp, link = "probit", data=pratergrouped) plot(fit1) predict.betareg Predicted values from beta regression model. This function returns predictions from a fitted betareg object.. predict.betareg(object, newdata = NULL, type = c("link", "response"),... ) object fitted model using betareg newdata optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used. type the type of prediction required. The default is on the scale of the linear predictors; the alternative "response" is on the scale of the response variable.... Optional arguments This version was modified to fit the standards of the lm and glm models. Andréa Vanessa Rocha (andrea@cox.de.ufpe.br) helped in the development of this new function. betareg, br.fit, summary.betareg, residuals.betareg summary(fit) new <- data.frame(x = cbind(0,1,1,0,1,0,1,1,1,201)) predict(fit) predict(fit,new) predict(fit,new,type="response")

residuals.betareg 15 residuals.betareg Residuals function for beta regression models. This function returns the standardized residuals from beta regression models, deviance residuals or the raw residuals. residuals.betareg(object, type=c("standardized", "raw", "deviance"),...) object type Fitted model using betareg. The desired type of residuals. This function returns by default the standardized residuals, also returns the deviance residuals and may return the raw residuals (which is the value minus estimated mean).... Optional arguments betareg, br.fit, summary.betareg, predict.betareg residuals(fit) residuals(fit,type="dev")

16 summary.betareg summary.betareg Summary method for Beta Regression summary method for class betareg. summary.betareg(object,...) object Fitted model using betareg... Optional arguments call the component from object deviance residuals a summary of the deviance residuals, see residuals.betareg coefficients a p by 4 matrix with the columns for the estimated coefficients, the std. errors, the critical values of a normal distribution and the corresponded p-values. estimated phi the estimated value of the precision parameter together with its standard error. null deviance the deviance from the model only containing the intercept (but, assuming the estimated phi from the current model) residual deviance the deviance from the current model log-likelihood ratio statistic the log-likelihood ratio statistic from the full model against the model containing only the intercept Pseudo R2 AIC the value of the pseudo R2 which is described by Ferrari and Cribari-Neto(2004). the corresponding AIC This version was modified to fit the standards of the lm and glm models. Andréa Vanessa Rocha (andrea@cox.de.ufpe.br) helped in the development of this new function. betareg, br.fit, predict.betareg, residuals.betareg

vcov.betareg 17 summary(fit) vcov.betareg Calculate Variance-Covariance Matrix for a betareg Fitted Model Object Returns the variance-covariance matrix of the main parameters of a betareg fitted model object. vcov.betareg(object,...) object a fitted model using betareg.... further arguments passed to or from other methods. A matrix of the estimated covariances between the parameter estimates in the linear or non-linear predictor of the model. This function was inspired on the function made by Achim Zeileis. vcov(fit)

Index Topic datasets prater, 12 pratergrouped, 13 Topic regression anova.betareg, 1 betareg, 2 br.fit, 3 cooks.distance.betareg, 4 df.residual.betareg, 5 envelope.beta, 6 estfun.betareg, 7 gen.lev.betareg, 8 hatvalues.betareg, 9 loglik.betareg, 10 plot.betareg, 11 predict.betareg, 14 residuals.betareg, 15 summary.betareg, 16 vcov.betareg, 17 residuals.betareg, 2 11, 14, 15, 16 summary.betareg, 2 10, 14, 15, 16 vcov.betareg, 17 anova.betareg, 1 betareg, 2, 4, 6, 11, 14 16 br.fit, 2, 3, 3, 5, 7 11, 14 16 cooks.distance.betareg, 4 df.residual.betareg, 5 envelope.beta, 6 estfun.betareg, 7 gen.lev.betareg, 8 hatvalues.betareg, 9 loglik.betareg, 10 plot (plot.betareg), 11 plot.betareg, 11 prater, 12 pratergrouped, 13 predict (predict.betareg), 14 predict.betareg, 2 11, 14, 15, 16 residuals (residuals.betareg), 15 18