# The R Stats Package

## Help Pages

 .checkMFClasses Functions to Check the Type of Variables passed to Model Frames .getXlevels Functions to Check the Type of Variables passed to Model Frames .MFclass Functions to Check the Type of Variables passed to Model Frames

## -- A --

 acf Auto- and Cross- Covariance and -Correlation Function Estimation acf2AR Compute an AR Process Exactly Fitting an ACF add.scope Compute Allowed Changes in Adding to or Dropping from a Formula add1 Add or Drop All Possible Single Terms to a Model addmargins Puts arbitrary margins on multidimensional tables or arrays. aggregate Compute Summary Statistics of Data Subsets AIC Akaike's An Information Criterion alias Find Aliases (Dependencies) in a Model anova Anova Tables anova.glm Analysis of Deviance for Generalized Linear Model Fits anova.glmlist Analysis of Deviance for Generalized Linear Model Fits anova.lm ANOVA for Linear Model Fits anova.lmlist ANOVA for Linear Model Fits anova.mlm Comparisons between multivariate linear models anova.mlmlist Comparisons between multivariate linear models ansari.test Ansari-Bradley Test aov Fit an Analysis of Variance Model approx Interpolation Functions approxfun Interpolation Functions ar Fit Autoregressive Models to Time Series ar.burg Fit Autoregressive Models to Time Series ar.mle Fit Autoregressive Models to Time Series ar.ols Fit Autoregressive Models to Time Series by OLS ar.yw Fit Autoregressive Models to Time Series arima ARIMA Modelling of Time Series arima.sim Simulate from an ARIMA Model arima0 ARIMA Modelling of Time Series - Preliminary Version ARMAacf Compute Theoretical ACF for an ARMA Process ARMAtoMA Convert ARMA Process to Infinite MA Process as.dendrogram General Tree Structures as.dist Distance Matrix Computation as.formula Model Formulae as.hclust Convert Objects to Class hclust as.matrix.dist Distance Matrix Computation as.stepfun Step Function Class as.table.ftable Manipulate Flat Contingency Tables as.ts Time-Series Objects asOneSidedFormula Convert to One-Sided Formula ave Group Averages Over Level Combinations of Factors

## -- B --

 bandwidth.kernel Smoothing Kernel Objects bartlett.test Bartlett Test for Homogeneity of Variances Beta The Beta Distribution binom.test Exact Binomial Test Binomial The Binomial Distribution binomial Family Objects for Models biplot Biplot of Multivariate Data biplot.prcomp Biplot for Principal Components biplot.princomp Biplot for Principal Components Box.test Box-Pierce and Ljung-Box Tests bw.bcv Bandwidth Selectors for Kernel Density Estimation bw.nrd Bandwidth Selectors for Kernel Density Estimation bw.nrd0 Bandwidth Selectors for Kernel Density Estimation bw.SJ Bandwidth Selectors for Kernel Density Estimation bw.ucv Bandwidth Selectors for Kernel Density Estimation

## -- C --

 C Sets Contrasts for a Factor cancor Canonical Correlations case.names Case and Variable Names of Fitted Models Cauchy The Cauchy Distribution cbind.ts Time-Series Objects ccf Auto- and Cross- Covariance and -Correlation Function Estimation chisq.test Pearson's Chi-squared Test for Count Data Chisquare The (non-central) Chi-Squared Distribution clearNames Remove the Names from an Object cmdscale Classical (Metric) Multidimensional Scaling coef Extract Model Coefficients coefficients Extract Model Coefficients complete.cases Find Complete Cases confint Confidence Intervals for Model Parameters constrOptim Linearly constrained optimisation contr.helmert Contrast Matrices contr.poly Contrast Matrices contr.SAS Contrast Matrices contr.sum Contrast Matrices contr.treatment Contrast Matrices contrasts Get and Set Contrast Matrices convolve Fast Convolution cooks.distance Regression Deletion Diagnostics cophenetic Cophenetic Distances for a Hierarchical Clustering cor Correlation, Variance and Covariance (Matrices) cor.test Test for Association/Correlation Between Paired Samples cov Correlation, Variance and Covariance (Matrices) cov.wt Weighted Covariance Matrices cov2cor Correlation, Variance and Covariance (Matrices) covratio Regression Deletion Diagnostics cpgram Plot Cumulative Periodogram cut.dendrogram General Tree Structures cutree Cut a tree into groups of data cycle Sampling Times of Time Series

## -- D --

 D Symbolic and Algorithmic Derivatives of Simple Expressions dbeta The Beta Distribution dbinom The Binomial Distribution dcauchy The Cauchy Distribution dchisq The (non-central) Chi-Squared Distribution decompose Classical Seasonal Decomposition by Moving Averages delete.response Modify Terms Objects deltat Sampling Times of Time Series dendrapply Apply a Function to All Nodes of a Dendrogram dendrogram General Tree Structures density Kernel Density Estimation deriv Symbolic and Algorithmic Derivatives of Simple Expressions deriv3 Symbolic and Algorithmic Derivatives of Simple Expressions deviance Model Deviance dexp The Exponential Distribution df The F Distribution df.kernel Smoothing Kernel Objects df.residual Residual Degrees-of-Freedom dfbeta Regression Deletion Diagnostics dfbetas Regression Deletion Diagnostics dffits Regression Deletion Diagnostics dgamma The Gamma Distribution dgeom The Geometric Distribution dhyper The Hypergeometric Distribution diff.ts Methods for Time Series Objects diffinv Discrete Integration: Inverse of Differencing dist Distance Matrix Computation dlnorm The Log Normal Distribution dlogis The Logistic Distribution dmultinom The Multinomial Distribution dnbinom The Negative Binomial Distribution dnorm The Normal Distribution dpois The Poisson Distribution drop.scope Compute Allowed Changes in Adding to or Dropping from a Formula drop.terms Modify Terms Objects drop1 Add or Drop All Possible Single Terms to a Model dsignrank Distribution of the Wilcoxon Signed Rank Statistic dt The Student t Distribution dummy.coef Extract Coefficients in Original Coding dunif The Uniform Distribution dweibull The Weibull Distribution dwilcox Distribution of the Wilcoxon Rank Sum Statistic

## -- E --

 ecdf Empirical Cumulative Distribution Function eff.aovlist Compute Efficiencies of Multistratum Analysis of Variance effects Effects from Fitted Model embed Embedding a Time Series end Encode the Terminal Times of Time Series Error Fit an Analysis of Variance Model estVar SSD matrix and estimated variance matrix in multivariate models expand.model.frame Add new variables to a model frame Exponential The Exponential Distribution extractAIC Extract AIC from a Fitted Model

## -- F --

 factanal Factor Analysis factanal.fit.mle Factor Analysis factor.scope Compute Allowed Changes in Adding to or Dropping from a Formula family Family Objects for Models family.glm Accessing Generalized Linear Model Fits family.lm Accessing Linear Model Fits FDist The F Distribution fft Fast Discrete Fourier Transform filter Linear Filtering on a Time Series fisher.test Fisher's Exact Test for Count Data fitted Extract Model Fitted Values fivenum Tukey Five-Number Summaries fligner.test Fligner-Killeen Test for Homogeneity of Variances format.dist Distance Matrix Computation formula Model Formulae formula.lm Accessing Linear Model Fits formula.nls Extract Model Formula from nls Object formula.terms Model Formulae frequency Sampling Times of Time Series friedman.test Friedman Rank Sum Test ftable Flat Contingency Tables ftable.formula Formula Notation for Flat Contingency Tables

## -- G --

 Gamma Family Objects for Models GammaDist The Gamma Distribution gaussian Family Objects for Models Geometric The Geometric Distribution getInitial Get Initial Parameter Estimates glm Fitting Generalized Linear Models glm.control Auxiliary for Controlling GLM Fitting glm.fit Fitting Generalized Linear Models

## -- H --

 hasTsp Tsp Attribute of Time-Series-like Objects hat Regression Deletion Diagnostics hatvalues Regression Deletion Diagnostics hclust Hierarchical Clustering heatmap Draw a Heat Map HoltWinters Holt-Winters Filtering Hypergeometric The Hypergeometric Distribution

## -- I --

 identify.hclust Identify Clusters in a Dendrogram influence Regression Diagnostics influence.measures Regression Deletion Diagnostics integrate Integration of One-Dimensional Functions interaction.plot Two-way Interaction Plot inverse.gaussian Family Objects for Models IQR The Interquartile Range is.empty.model Check if a Model is Empty is.leaf General Tree Structures is.mts Time-Series Objects is.stepfun Step Function Class is.ts Time-Series Objects is.tskernel Smoothing Kernel Objects isoreg Isotonic / Monotone Regression

## -- K --

 KalmanForecast Kalman Filtering KalmanLike Kalman Filtering KalmanRun Kalman Filtering KalmanSmooth Kalman Filtering kernapply Apply Smoothing Kernel kernel Smoothing Kernel Objects kmeans K-Means Clustering knots Step Function Class kruskal.test Kruskal-Wallis Rank Sum Test ks.test Kolmogorov-Smirnov Tests ksmooth Kernel Regression Smoother

## -- L --

 labels.dendrogram Ordering or Labels of the Leaves in a Dendrogram labels.lm Accessing Linear Model Fits labels.terms Model Terms lag Lag a Time Series lag.plot Time Series Lag Plots line Robust Line Fitting lines.stepfun Plot Step Functions lines.ts Plotting Time-Series Objects lm Fitting Linear Models lm.fit Fitter Functions for Linear Models lm.influence Regression Diagnostics lm.wfit Fitter Functions for Linear Models loadings Print Loadings in Factor Analysis loess Local Polynomial Regression Fitting loess.control Set Parameters for Loess loess.smooth Scatter Plot with Smooth Curve Fitted by Loess Logistic The Logistic Distribution logLik Extract Log-Likelihood loglin Fitting Log-Linear Models Lognormal The Log Normal Distribution lowess Scatter Plot Smoothing ls.diag Compute Diagnostics for `lsfit' Regression Results ls.print Print `lsfit' Regression Results lsfit Find the Least Squares Fit

## -- M --

 mad Median Absolute Deviation mahalanobis Mahalanobis Distance make.link Create a Link for GLM families makeARIMA Kalman Filtering makepredictcall Utility Function for Safe Prediction makepredictcall.poly Compute Orthogonal Polynomials manova Multivariate Analysis of Variance mantelhaen.test Cochran-Mantel-Haenszel Chi-Squared Test for Count Data mauchley.test Mauchley's test of sphericity mcnemar.test McNemar's Chi-squared Test for Count Data median Median Value medpolish Median Polish of a Matrix model.extract Extract Components from a Model Frame model.frame Extracting the ``Environment'' of a Model Formula model.matrix Construct Design Matrices model.offset Extract Components from a Model Frame model.response Extract Components from a Model Frame model.tables Compute Tables of Results from an Aov Model Fit model.weights Extract Components from a Model Frame monthplot Plot a Seasonal or other Subseries mood.test Mood Two-Sample Test of Scale Multinomial The Multinomial Distribution mvfft Fast Discrete Fourier Transform

## -- N --

 na.action NA Action na.contiguous Find Longest Contiguous Stretch of non-NAs na.exclude Handle Missing Values in Objects na.fail Handle Missing Values in Objects na.omit Handle Missing Values in Objects na.omit.ts Methods for Time Series Objects na.pass Handle Missing Values in Objects napredict Adjust for Missing Values naprint Adjust for Missing Values naresid Adjust for Missing Values NegBinomial The Negative Binomial Distribution nextn Highly Composite Numbers nlm Non-Linear Minimization nls Nonlinear Least Squares nls.control Control the Iterations in nls nlsModel Create an nlsModel Object NLSstAsymptotic Fit the Asymptotic Regression Model NLSstClosestX Inverse Interpolation NLSstLfAsymptote Horizontal Asymptote on the Left Side NLSstRtAsymptote Horizontal Asymptote on the Right Side Normal The Normal Distribution numericDeriv Evaluate derivatives numerically

## -- O --

 offset Include an Offset in a Model Formula oneway.test Test for Equal Means in a One-Way Layout Ops.ts Time-Series Objects optim General-purpose Optimization optimise One Dimensional Optimization optimize One Dimensional Optimization order.dendrogram Ordering or Labels of the Leaves in a Dendrogram

## -- P --

 p.adjust Adjust P-values for Multiple Comparisons pacf Auto- and Cross- Covariance and -Correlation Function Estimation pairwise.prop.test Pairwise comparisons of proportions pairwise.t.test Pairwise t tests pairwise.table Tabulate p values for pairwise comparisons pairwise.wilcox.test Pairwise Wilcoxon rank sum tests pbeta The Beta Distribution pbinom The Binomial Distribution pbirthday Probability of coincidences pcauchy The Cauchy Distribution pchisq The (non-central) Chi-Squared Distribution pexp The Exponential Distribution pf The F Distribution pgamma The Gamma Distribution pgeom The Geometric Distribution phyper The Hypergeometric Distribution plclust Hierarchical Clustering plnorm The Log Normal Distribution plogis The Logistic Distribution plot.acf Plot Autocovariance and Autocorrelation Functions plot.decomposed.ts Classical Seasonal Decomposition by Moving Averages plot.dendrogram General Tree Structures plot.density Plot Method for Kernel Density Estimation plot.ecdf Empirical Cumulative Distribution Function plot.hclust Hierarchical Clustering plot.HoltWinters Plot function for HoltWinters objects plot.isoreg Plot Method for isoreg Objects plot.lm Plot Diagnostics for an lm Object plot.mlm Plot Diagnostics for an lm Object plot.ppr Plot Ridge Functions for Projection Pursuit Regression Fit plot.prcomp Principal Components Analysis plot.princomp Principal Components Analysis plot.profile.nls Plot a profile.nls Object plot.spec Plotting Spectral Densities plot.stepfun Plot Step Functions plot.stl Methods for STL Objects plot.ts Plotting Time-Series Objects plot.TukeyHSD Compute Tukey Honest Significant Differences pnbinom The Negative Binomial Distribution pnorm The Normal Distribution Poisson The Poisson Distribution poisson Family Objects for Models poly Compute Orthogonal Polynomials polym Compute Orthogonal Polynomials power Create a Power Link Object power.anova.test Power calculations for balanced one-way analysis of variance tests power.prop.test Power calculations two sample test for of proportions power.t.test Power calculations for one and two sample t tests PP.test Phillips-Perron Test for Unit Roots ppoints Ordinates for Probability Plotting ppois The Poisson Distribution ppr Projection Pursuit Regression prcomp Principal Components Analysis predict Model Predictions predict.ar Fit Autoregressive Models to Time Series predict.Arima Forecast from ARIMA fits predict.arima0 ARIMA Modelling of Time Series - Preliminary Version predict.glm Predict Method for GLM Fits predict.HoltWinters prediction function for fitted Holt-Winters models predict.lm Predict method for Linear Model Fits predict.loess Predict Loess Curve or Surface predict.mlm Predict method for Linear Model Fits predict.nls Predicting from Nonlinear Least Squares Fits predict.poly Compute Orthogonal Polynomials predict.prcomp Principal Components Analysis predict.princomp Principal Components Analysis predict.smooth.spline Predict from Smoothing Spline Fit predict.StructTS Fit Structural Time Series preplot Pre-computations for a Plotting Objeect princomp Principal Components Analysis print.anova Anova Tables print.aov Fit an Analysis of Variance Model print.aovlist Fit an Analysis of Variance Model print.ar Fit Autoregressive Models to Time Series print.arima0 ARIMA Modelling of Time Series - Preliminary Version print.dendrogram General Tree Structures print.density Kernel Density Estimation print.dist Distance Matrix Computation print.dummy.coef Extract Coefficients in Original Coding print.ecdf Empirical Cumulative Distribution Function print.factanal Print Loadings in Factor Analysis print.family Family Objects for Models print.formula Model Formulae print.ftable Flat Contingency Tables print.glm Fitting Generalized Linear Models print.hclust Hierarchical Clustering print.infl Regression Deletion Diagnostics print.integrate Integration of One-Dimensional Functions print.kmeans K-Means Clustering print.lm Fitting Linear Models print.loadings Print Loadings in Factor Analysis print.logLik Extract Log-Likelihood print.power.htest Print method for power calculation object print.prcomp Principal Components Analysis print.princomp Principal Components Analysis print.stepfun Step Function Class print.StructTS Fit Structural Time Series print.summary.aov Summarize an Analysis of Variance Model print.summary.aovlist Summarize an Analysis of Variance Model print.summary.glm Summarizing Generalized Linear Model Fits print.summary.lm Summarizing Linear Model Fits print.summary.manova Summary Method for Multivariate Analysis of Variance print.summary.prcomp Principal Components Analysis print.summary.princomp Summary method for Principal Components Analysis print.terms Model Terms print.ts Printing Time-Series Objects print.TukeyHSD Compute Tukey Honest Significant Differences print.xtabs Cross Tabulation printCoefmat Print Coefficient Matrices profile Generic Function for Profiling Models profile.nls Method for Profiling nls Objects profiler Constructor for Profiler Objects for Nonlinear Models profiler.nls Constructor for Profiler Objects from nls Objects proj Projections of Models promax Rotation Methods for Factor Analysis prop.test Test for Equal or Given Proportions prop.trend.test Test for trend in proportions psignrank Distribution of the Wilcoxon Signed Rank Statistic pt The Student t Distribution ptukey The Studentized Range Distribution punif The Uniform Distribution pweibull The Weibull Distribution pwilcox Distribution of the Wilcoxon Rank Sum Statistic

## -- Q --

 qbeta The Beta Distribution qbinom The Binomial Distribution qbirthday Probability of coincidences qcauchy The Cauchy Distribution qchisq The (non-central) Chi-Squared Distribution qexp The Exponential Distribution qf The F Distribution qgamma The Gamma Distribution qgeom The Geometric Distribution qhyper The Hypergeometric Distribution qlnorm The Log Normal Distribution qlogis The Logistic Distribution qnbinom The Negative Binomial Distribution qnorm The Normal Distribution qpois The Poisson Distribution qqline Quantile-Quantile Plots qqnorm Quantile-Quantile Plots qqplot Quantile-Quantile Plots qsignrank Distribution of the Wilcoxon Signed Rank Statistic qt The Student t Distribution qtukey The Studentized Range Distribution quade.test Quade Test quantile Sample Quantiles quasi Family Objects for Models quasibinomial Family Objects for Models quasipoisson Family Objects for Models qunif The Uniform Distribution qweibull The Weibull Distribution qwilcox Distribution of the Wilcoxon Rank Sum Statistic

## -- R --

 rbeta The Beta Distribution rbinom The Binomial Distribution rcauchy The Cauchy Distribution rchisq The (non-central) Chi-Squared Distribution read.ftable Manipulate Flat Contingency Tables rect.hclust Draw Rectangles Around Hierarchical Clusters reformulate Modify Terms Objects relevel Reorder Levels of Factor reorder Reorder a dendrogram reorder.factor Reorder levels of a factor replications Number of Replications of Terms reshape Reshape Grouped Data resid Extract Model Residuals residuals Extract Model Residuals residuals.glm Accessing Generalized Linear Model Fits residuals.lm Accessing Linear Model Fits residuals.tukeyline Robust Line Fitting rev.dendrogram General Tree Structures rexp The Exponential Distribution rf The F Distribution rgamma The Gamma Distribution rgeom The Geometric Distribution rhyper The Hypergeometric Distribution rlnorm The Log Normal Distribution rlogis The Logistic Distribution rmultinom The Multinomial Distribution rnbinom The Negative Binomial Distribution rnorm The Normal Distribution rpois The Poisson Distribution rsignrank Distribution of the Wilcoxon Signed Rank Statistic rstandard Regression Deletion Diagnostics rstudent Regression Deletion Diagnostics rt The Student t Distribution runif The Uniform Distribution runmed Running Medians - Robust Scatter Plot Smoothing rweibull The Weibull Distribution rwilcox Distribution of the Wilcoxon Rank Sum Statistic

## -- S --

 SafePrediction Utility Function for Safe Prediction scatter.smooth Scatter Plot with Smooth Curve Fitted by Loess screeplot Screeplot of PCA Results sd Standard Deviation se.contrast Standard Errors for Contrasts in Model Terms selfStart Construct Self-starting Nonlinear Models setNames Set the Names in an Object shapiro.test Shapiro-Wilk Normality Test SignRank Distribution of the Wilcoxon Signed Rank Statistic smooth Tukey's (Running Median) Smoothing smooth.spline Fit a Smoothing Spline smoothEnds End Points Smoothing (for Running Medians) sortedXyData Create a sortedXyData object spec Spectral Density Estimation spec.ar Estimate Spectral Density of a Time Series from AR Fit spec.pgram Estimate Spectral Density of a Time Series by a Smoothed Periodogram spec.taper Taper a Time Series by a Cosine Bell spectrum Spectral Density Estimation spline Interpolating Splines splinefun Interpolating Splines SSasymp Asymptotic Regression Model SSasympOff Asymptotic Regression Model with an Offset SSasympOrig Asymptotic Regression Model through the Origin SSbiexp Biexponential model SSD SSD matrix and estimated variance matrix in multivariate models SSfol First-order Compartment Model SSfpl Four-parameter Logistic Model SSgompertz Gompertz Growth Model SSlogis Logistic Model SSmicmen Michaelis-Menten Model SSweibull Weibull growth curve model start Encode the Terminal Times of Time Series stat.anova GLM Anova Statistics step Choose a model by AIC in a Stepwise Algorithm stepfun Step Function Class stl Seasonal Decomposition of Time Series by Loess str.dendrogram General Tree Structures str.logLik Extract Log-Likelihood StructTS Fit Structural Time Series summary.aov Summarize an Analysis of Variance Model summary.aovlist Summarize an Analysis of Variance Model summary.glm Summarizing Generalized Linear Model Fits summary.infl Regression Deletion Diagnostics summary.lm Summarizing Linear Model Fits summary.manova Summary Method for Multivariate Analysis of Variance summary.mlm Summarizing Linear Model Fits summary.prcomp Principal Components Analysis summary.princomp Summary method for Principal Components Analysis summary.stepfun Step Function Class supsmu Friedman's SuperSmoother symnum Symbolic Number Coding

## -- T --

 t.test Student's t-Test t.ts Time-Series Objects TDist The Student t Distribution termplot Plot regression terms terms Model Terms terms.formula Construct a terms Object from a Formula terms.object Description of Terms Objects terms.terms Model Terms time Sampling Times of Time Series toeplitz Form Symmetric Toeplitz Matrix ts Time-Series Objects ts.intersect Bind Two or More Time Series ts.plot Plot Multiple Time Series ts.union Bind Two or More Time Series tsdiag Diagnostic Plots for Time-Series Fits tsp Tsp Attribute of Time-Series-like Objects tsSmooth Use Fixed-Interval Smoothing on Time Series Tukey The Studentized Range Distribution TukeyHSD Compute Tukey Honest Significant Differences

## -- U --

 Uniform The Uniform Distribution uniroot One Dimensional Root (Zero) Finding update Update and Re-fit a Model Call update.formula Model Updating

## -- V --

 var Correlation, Variance and Covariance (Matrices) var.test F Test to Compare Two Variances variable.names Case and Variable Names of Fitted Models varimax Rotation Methods for Factor Analysis vcov Calculate Variance-Covariance Matrix for a Fitted Model Object

## -- W --

 Weibull The Weibull Distribution weighted.mean Weighted Arithmetic Mean weighted.residuals Compute Weighted Residuals weights Accessing Linear Model Fits weights.glm Fitting Generalized Linear Models wilcox.test Wilcoxon Rank Sum and Signed Rank Tests Wilcoxon Distribution of the Wilcoxon Rank Sum Statistic window Time Windows write.ftable Manipulate Flat Contingency Tables

## -- X --

 xtabs Cross Tabulation

## -- misc --

 [.acf Auto- and Cross- Covariance and -Correlation Function Estimation [.formula Model Formulae [.terms Modify Terms Objects [.ts Time-Series Objects [[.dendrogram General Tree Structures