R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("betareg-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('betareg') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "betareg" > > ### * betareg > > flush(stderr()); flush(stdout()) > > ### Name: betareg > ### Title: Fitting beta regression models > ### Aliases: betareg > ### Keywords: regression > > ### ** Examples > > data(pratergrouped) > attach(pratergrouped) > y <- V11/100 > X <- cbind(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10) > fit1 <- betareg(y ~ X) > fit2 <- betareg(y ~ X, link = "probit") > summary(fit1) Call: betareg(formula = y ~ X) Coefficients: estimates std. errors z-stats p-value (Intercept) -6.1593252 1.822890e-01 -33.788790 0.000000e+00 XV1 1.7276852 1.012102e-01 17.070274 0.000000e+00 XV2 1.3224819 1.178804e-01 11.218842 0.000000e+00 XV3 1.5721820 1.160832e-01 13.543583 0.000000e+00 XV4 1.0596482 1.023407e-01 10.354122 0.000000e+00 XV5 1.1336960 1.035039e-01 10.953173 0.000000e+00 XV6 1.0400627 1.060171e-01 9.810328 0.000000e+00 XV7 0.5436083 1.091076e-01 4.982313 6.282875e-07 XV8 0.4960878 1.089023e-01 4.555347 5.229919e-06 XV9 0.3857641 1.185713e-01 3.253437 1.140179e-03 XV10 0.0109663 4.125667e-04 26.580670 0.000000e+00 phi 440.4411111 1.100663e+02 Pseudo R^2: 0.9617293 > par(mfrow=c(2,2)) > plot(fit1) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "br.fit" > > ### * br.fit > > flush(stderr()); flush(stdout()) > > ### Name: br.fit > ### Title: Function to estimate the coefficients of the Beta Regression. > ### Aliases: br.fit > ### Keywords: regression > > ### ** Examples > > x <- cbind(rnorm(10),rnorm(10)) > y <- cbind(rbeta(10,1,1)) > link = betareg(y ~ x)$funlink > br.fit(x,y,link) $coeff x1 x2 0.9843146 -0.3477668 $beta x1 x2 1.3512410 -0.5583099 $phi [1] 5.509029 $fitted [1] 0.2418846 0.5112951 0.3528638 0.9121727 0.4832876 0.3117453 0.6190255 [8] 0.5983293 0.5698297 0.3758648 $phiest 5.7319 $stderrors [1] 0.3759323 0.2664689 $k [1] 2 $h [1] 0.25805119 0.02985634 0.22203414 0.60454596 0.19647000 0.14215685 [7] 0.05185620 0.26349206 0.18057565 0.05096160 $GL [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.27797251 -0.04743613 0.01324080 -1.26982696 0.08808152 0.09839473 [2,] 0.06074678 0.04019277 -0.06338134 -0.14229256 0.09139490 -0.03323445 [3,] -0.03538295 -0.14027193 0.19010320 -0.22963795 -0.21999034 0.14587565 [4,] -0.20114513 0.06614373 -0.05128974 1.00395679 -0.01833381 -0.10564742 [5,] 0.19661086 0.08291683 -0.14330604 -0.58668366 0.22849626 -0.05649794 [6,] 0.06741044 -0.11703566 0.14154628 -0.59016444 -0.12922949 0.13811405 [7,] -0.05236485 0.07539059 -0.08960534 0.41692947 0.07823497 -0.09048166 [8,] 0.11123563 0.14012796 -0.20326921 -0.08263877 0.26229143 -0.13288393 [9,] 0.10570690 0.11358856 -0.16750700 -0.13087933 0.22132258 -0.10508705 [10,] 0.14565365 -0.03300846 0.01762472 -0.68717359 0.03452004 0.06038372 [,7] [,8] [,9] [,10] [1,] -0.05148187 0.5271086 0.09975646 0.094944128 [2,] 0.02014308 0.3024859 0.07749188 0.017224335 [3,] -0.08429501 -0.6090934 -0.17386014 -0.001886637 [4,] 0.05700991 -0.2635548 -0.03713715 -0.070920946 [5,] 0.03590538 0.8042774 0.19884953 0.059035689 [6,] -0.07801261 -0.2631102 -0.09205305 0.030380926 [7,] 0.05096174 0.1468799 0.05440815 -0.022518010 [8,] 0.07819481 0.8003481 0.21518122 0.026902572 [9,] 0.06215385 0.6880552 0.18292441 0.026929911 [10,] -0.03203795 0.2459965 0.04329079 0.050317663 $resstd [,1] [1,] -0.4419602 [2,] -1.5505133 [3,] 0.7227975 [4,] 0.9401579 [5,] -1.2487976 [6,] 1.2738582 [7,] -0.3134277 [8,] 2.0412297 [9,] 0.6593862 [10,] -0.2082408 $resd [,1] [1,] 0.0000000 [2,] -1.3940078 [3,] 0.6486132 [4,] 0.0000000 [5,] -0.9667382 [6,] 1.0986649 [7,] -0.3533108 [8,] 1.8450370 [9,] 0.4309098 [10,] 0.0000000 $phistd [1] 2.432984 $zstats x1 x2 2.618329 -1.305093 $res [1] -0.06283088 -0.29422791 0.11741661 0.06449607 -0.21560138 0.21063510 [7] -0.05712259 0.33099161 0.11389856 -0.03786990 $pvalues x1 x2 0.008836149 0.191861054 $pseudor2 [,1] [1,] 0.66243 $etahat [,1] [1,] -1.14237496 [2,] 0.04518826 [3,] -0.60647458 [4,] 2.34045732 [5,] -0.06687434 [6,] -0.79197259 [7,] 0.48541397 [8,] 0.39850887 [9,] 0.28115651 [10,] -0.50713742 $sigma2 [1] 0.0013725697 0.0025484964 0.0021283987 0.0002619753 0.0025454024 [6] 0.0018790811 0.0022701590 0.0023575895 0.0024525528 0.0022463015 > > > > cleanEx(); ..nameEx <- "envelope.beta" > > ### * envelope.beta > > flush(stderr()); flush(stdout()) > > ### Name: envelope.beta > ### Title: Half-Normal Plot of Standardized and Deviance Residuals > ### Aliases: envelope.beta > ### Keywords: regression > > ### ** Examples > > data(pratergrouped) > attach(pratergrouped) > y <- V11/100 > X <- cbind(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10) > fit <- betareg(y ~ X) > envelope.beta(fit) > > > > cleanEx(); ..nameEx <- "plot.betareg" > > ### * plot.betareg > > flush(stderr()); flush(stdout()) > > ### Name: plot.betareg > ### Title: Plot Diagnostics for an betareg Object > ### Aliases: plot.betareg plot > ### Keywords: regression > > ### ** Examples > > data(pratergrouped) > attach(pratergrouped) > y <- V11/100 > X <- cbind(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10) > fit <- betareg(y ~ X) > par(mfrow=c(2,2)) > plot(fit) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "prater" > > ### * prater > > flush(stderr()); flush(stdout()) > > ### Name: prater > ### Title: Prater's gasoline data > ### Aliases: prater > ### Keywords: datasets > > ### ** Examples > > data(prater) > fit <- betareg(V5/100 ~ V1 + V2 + V3 + V4, data=prater) > plot(fit) > > > > cleanEx(); ..nameEx <- "pratergrouped" > > ### * pratergrouped > > flush(stderr()); flush(stdout()) > > ### Name: pratergrouped > ### Title: Grouped Prater's gasoline data > ### Aliases: pratergrouped > ### Keywords: datasets > > ### ** Examples > > data(pratergrouped) > attach(pratergrouped) > y <- V11/100 > X <- cbind(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10) > fit1 <- betareg(y ~ X) > fit2 <- betareg(y ~ X, link = "probit") > plot(fit1) > > > > cleanEx(); ..nameEx <- "predict.betareg" > > ### * predict.betareg > > flush(stderr()); flush(stdout()) > > ### Name: predict.betareg > ### Title: Predicted values from beta regression model. > ### Aliases: predict.betareg predict > ### Keywords: regression > > ### ** Examples > > data(pratergrouped) > attach(pratergrouped) > y <- V11/100 > X <- cbind(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10) > fit <- betareg(y ~ X) > predict(fit) [1] 0.10123758 0.19530392 0.34338021 0.50791027 0.07971761 0.13669173 [7] 0.26278614 0.09429480 0.16738012 0.29763161 0.07428917 0.14066384 [13] 0.25030659 0.35354465 0.15989959 0.26874537 0.33315695 0.10053804 [19] 0.23660296 0.32941983 0.04571061 0.06913941 0.15580454 0.25850824 [25] 0.07324752 0.15968976 0.31126744 0.12737282 0.24529780 0.10371367 [31] 0.11887805 0.18758958 > predict(fit,c(2,3,4,5,6,7,8,9,10,11)) [1] 1 > > > > cleanEx(); ..nameEx <- "residuals.betareg" > > ### * residuals.betareg > > flush(stderr()); flush(stdout()) > > ### Name: residuals.betareg > ### Title: Residuals function for beta regression models. > ### Aliases: residuals.betareg residuals > ### Keywords: regression > > ### ** Examples > > data(pratergrouped) > attach(pratergrouped) > y <- V11/100 > X <- cbind(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10) > fit <- betareg(y ~ X) > residuals(fit) [1] 1.44617558 1.46785545 0.16016784 -2.13956807 0.02190523 -0.34811798 [7] 0.15341414 -1.45909625 0.82282019 0.29264675 -0.42376373 0.68506140 [13] 0.47014836 -0.77106268 -0.91145059 -0.03532654 0.70621840 -0.03759188 [19] 0.56343407 -0.55520310 -1.78164553 -0.42564200 0.30098798 0.93539929 [25] -1.87471256 0.93548812 0.44164312 0.79577469 -0.64935421 -1.28959673 [31] 1.82563068 -0.40847161 > residuals(fit,type="dev") [1] 1.42523528 1.45241489 0.17457841 -2.13872222 0.06102107 -0.29623226 [7] 0.17652939 -1.49327388 0.84397483 0.31119898 -0.34480028 0.71614445 [13] 0.49183498 -0.76058475 -0.88931160 0.00000000 0.71594730 0.00000000 [19] 0.58486560 -0.53994339 -1.94944134 -0.34259975 0.33984694 0.94465057 [25] -2.01268847 0.95206426 0.45720818 0.82394748 -0.62699525 -1.29809213 [31] 1.76675092 -0.37142761 > > > > cleanEx(); ..nameEx <- "summary.betareg" > > ### * summary.betareg > > flush(stderr()); flush(stdout()) > > ### Name: summary.betareg > ### Title: Summary method for Beta Regression > ### Aliases: summary.betareg > ### Keywords: regression > > ### ** Examples > > data(pratergrouped) > attach(pratergrouped) > y <- V11/100 > X <- cbind(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10) > fit <- betareg(y ~ X) > summary(fit) Call: betareg(formula = y ~ X) Coefficients: estimates std. errors z-stats p-value (Intercept) -6.1593252 1.822890e-01 -33.788790 0.000000e+00 XV1 1.7276852 1.012102e-01 17.070274 0.000000e+00 XV2 1.3224819 1.178804e-01 11.218842 0.000000e+00 XV3 1.5721820 1.160832e-01 13.543583 0.000000e+00 XV4 1.0596482 1.023407e-01 10.354122 0.000000e+00 XV5 1.1336960 1.035039e-01 10.953173 0.000000e+00 XV6 1.0400627 1.060171e-01 9.810328 0.000000e+00 XV7 0.5436083 1.091076e-01 4.982313 6.282875e-07 XV8 0.4960878 1.089023e-01 4.555347 5.229919e-06 XV9 0.3857641 1.185713e-01 3.253437 1.140179e-03 XV10 0.0109663 4.125667e-04 26.580670 0.000000e+00 phi 440.4411111 1.100663e+02 Pseudo R^2: 0.9617293 > > > > ### *