R Function Essay

Submitted By stella870731
Words: 2292
Pages: 10

Vito Ricci - R Functions For Regression Analysis – 14/10/05 (vito_ricci@yahoo.com)

R FUNCTIONS FOR REGRESSION ANALYSIS
Here are some helpful R functions for regression analysis grouped by their goal. The name of package is in parentheses.

Linear model
Anova: Anova Tables for Linear and Generalized Linear Models (car) anova: Compute an analysis of variance table for one or more linear model fits (stasts) coef: is a generic function which extracts model coefficients from objects returned by modeling functions. coefficients is an alias for it (stasts) coeftest: Testing Estimated Coefficients (lmtest) confint: Computes confidence intervals for one or more parameters in a fitted model. Base has a method for objects inheriting from class "lm" (stasts) deviance:Returns the deviance of a fitted model object (stats) effects: Returns (orthogonal) effects from a fitted model, usually a linear model. This is a generic function, but currently only has a methods for objects inheriting from classes "lm" and "glm" (stasts) fitted: is a generic function which extracts fitted values from objects returned by modeling functions fitted.values is an alias for it (stasts) formula: provide a way of extracting formulae which have been included in other objects (stasts) linear.hypothesis: Test Linear Hypothesis (car) lm: is used to fit linear models. It can be used to carry out regression, single stratum analysis of variance and analysis of covariance (stasts) model.matrix: creates a design matrix (stasts) predict: Predicted values based on linear model object (stasts) residuals: is a generic function which extracts model residuals from objects returned by modeling functions (stasts) summary.lm: summary method for class "lm" (stats) vcov: Returns the variance-covariance matrix of the main parameters of a fitted model object (stasts)

Model – Variables selection add1: Compute all the single terms in the scope argument that can be added to or dropped from the model, fit those models and compute a table of the changes in fit (stats) AIC: Generic function calculating the Akaike information criterion for one or several fitted model objects for which a log-likelihood value can be obtained, according to the formula -2*log-likelihood + k*npar, where npar represents the number of parameters in the fitted model, and k = 2 for the usual AIC, or k = log(n) (n the number of observations) for the so-called BIC or SBC (Schwarz's Bayesian criterion) (stats) Cpplot: Cp plot (faraway) drop1: Compute all the single terms in the scope argument that can be added to or dropped from the model, fit those models and compute a table of the changes in fit (stats) extractAIC: Computes the (generalized) Akaike An Information Criterion for a fitted parametric model (stats) leaps: Subset selection by `leaps and bounds' (leaps) maxadjr: Maximum Adjusted R-squared (faraway) offset: An offset is a term to be added to a linear predictor, such as in a generalised linear model, with known coefficient 1 rather than an estimated coefficient (stats) step: Select a formula-based model by AIC (stats) update.formula: is used to update model formulae. This typically involves adding or dropping terms, but updates can be more general (stats) 1

Vito Ricci - R Functions For Regression Analysis – 14/10/05 (vito_ricci@yahoo.com)

Diagnostics cookd: Cook's Distances for Linear and Generalized Linear Models (car) cooks.distance: Cook’s distance (stats) covratio: covariance ratio (stats) dfbeta: DBETA (stats) dfbetas: DBETAS (stats) dffits: DFFTITS (stats) hat: diagonal elements of the hat matrix (stats) hatvalues: diagonal elements of the hat matrix (stats) influence.measures: This suite of functions can be used to compute some of the regression (leave-one-out deletion) diagnostics for linear and generalized linear models (stats) lm.influence: This function provides the basic quantities which are used in forming a wide variety of diagnostics for checking the quality of regression fits