0% found this document useful (0 votes)
2 views2 pages

Week13 - LAQs - SWR

R offers a comprehensive set of statistical functions for data analysis, including descriptive statistics, probability distributions, hypothesis testing, correlation and regression, time series analysis, resampling, multivariate analysis, and goodness-of-fit tests. Key functions include mean, median, t-tests, linear models, and PCA, among others. These tools enable users to perform complex statistical analyses and model building efficiently.

Uploaded by

akashrs2604
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Week13 - LAQs - SWR

R offers a comprehensive set of statistical functions for data analysis, including descriptive statistics, probability distributions, hypothesis testing, correlation and regression, time series analysis, resampling, multivariate analysis, and goodness-of-fit tests. Key functions include mean, median, t-tests, linear models, and PCA, among others. These tools enable users to perform complex statistical analyses and model building efficiently.

Uploaded by

akashrs2604
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Describe about various statistical functions in R.

R provides a wide range of statistical functions for data analysis, hypothesis testing, and
model building. Here are some key categories of statistical functions in R:

1. Descriptive Statistics

 mean(x): Computes the arithmetic mean.


 median(x): Finds the median (middle value).
 sd(x): Calculates the standard deviation.
 var(x): Computes variance.
 summary(x): Provides a summary including min, max, mean, median, and
quartiles.
 range(x): Returns the minimum and maximum values.
 quantile(x, probs): Finds specific quantiles.

2. Probability Distributions

R has built-in functions for various probability distributions:

 Normal Distribution: dnorm(x, mean, sd), pnorm(q, mean, sd), qnorm(p,


mean, sd), rnorm(n, mean, sd)
 Binomial Distribution: dbinom(x, size, prob), pbinom(q, size, prob),
qbinom(p, size, prob), rbinom(n, size, prob)
 Poisson Distribution: dpois(x, lambda), ppois(q, lambda), qpois(p,
lambda), rpois(n, lambda)
 Similar functions exist for other distributions like dexp(), dgamma(), dchisq(),
dt(), etc.

3. Hypothesis Testing

 t.test(x, y, paired = FALSE): Performs a t-test.


 wilcox.test(x, y): Performs the Wilcoxon test (non-parametric alternative to
t-test).
 chisq.test(x, y): Conducts a Chi-square test.
 anova(model): Performs an ANOVA test.
 ks.test(x, y): Conducts the Kolmogorov-Smirnov test.

4. Correlation & Regression

 cor(x, y, method = "pearson"): Computes the correlation coefficient


(Pearson, Spearman, Kendall).
 cov(x, y): Finds the covariance.
 lm(y ~ x): Fits a linear regression model.
 glm(y ~ x, family = binomial): Fits a generalized linear model (e.g., logistic
regression).

5. Time Series Analysis

 ts(data, start, frequency): Creates a time series object.


 acf(x): Computes the autocorrelation function.
 pacf(x): Computes the partial autocorrelation function.
 arima(x, order = c(p, d, q)): Fits an ARIMA model.

6. Resampling & Simulation

 sample(x, size, replace): Randomly selects elements from a vector.


 boot(data, statistic, R): Performs bootstrap resampling (requires the boot
package).
 set.seed(n): Sets a random seed for reproducibility.

7. Multivariate Analysis

 prcomp(x): Performs Principal Component Analysis (PCA).


 hclust(d): Performs hierarchical clustering.
 kmeans(x, centers): Conducts k-means clustering.
 dist(x): Computes the distance matrix for clustering.

8. Goodness-of-Fit Tests

 shapiro.test(x): Tests for normality (Shapiro-Wilk test).


 ks.test(x, "pnorm"): Tests whether data follows a normal distribution.
 bartlett.test(x, g): Tests for homogeneity of variances.

These functions make R a powerful tool for statistical analysis, modeling, and data
visualization. Let me know if you need details on any specific function!

You might also like