Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

JADS Premaster - Statistics for Data Scientists [R] Cheatsheet

Rating
-
Sold
-
Pages
5
Uploaded on
02-01-2022
Written in
2020/2021

[R] Cheatsheet for the Statistics for Data Scientists course of the Premaster Data Science and Entrepreneurship.

Institution
Course

Content preview

################################################################################
################################### 0. Setup ###################################
################################################################################

library(e1071) # skewness, kurtosis
library(MASS) # fitdistr
library(outliers) # grubbs.test

################################################################################
################################### 1. Basics ##################################
################################################################################

### 1.1 Dimensions (rows, columns)
dim(data)

### 1.2 First n rows (n = 6)
head(data, n = 6)

### 1.3 Summary
summary(data)

### 1.4 Mean
mean(data$column)

### 1.5 Variance
var(data$column)

### 1.6 Standard Deviation
sd(data$column)

### 1.7 Median
median(data$column)

### 1.8 Mode
mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
mode(data$column)

### 1.9 Min & Max
min(data$column)
max(data$column)

### 1.10 Unique
unique(data$column)

### 1.11 Quantile (probs = c(0, 0.25, 0.50, 0.75, 1.00))
quantile(data$column, probs = c(0, 0.25, 0.50, 0.75, 1.00))

### 1.12 Interquartile Range (IQR)
first <- quantile(data$column, probs = c(0.25))
third <- quantile(data$column, probs = c(0.75))
first - third

### 1.13 Mean Absolute Deviation (MAD)
sum(abs(data$column - mean(data$column))) / length(data$column)

### 1.14 Mean Squared Deviation (MSD)

, (length(data$column) - 1) * var(data$column) / length(data$column)

### 1.15 Skewness
skewness(data$column)

### 1.16 Kurtosis
kurtosis(data$column)

################################################################################
################################## 2. Sampling #################################
################################################################################

### 2.1 Simple Random Sampling (n = 1, replacement = FALSE)
sample(data$column, 1, replace = FALSE)

### 2.2 Simple Random Subsets (N = population size, n = sample size)
N <- 9
n <- 3
combn(N, n)

### 2.3 Systematic Random Subsets (X = population)
X <- 1:9
rbind(X[1:3], X[4:6], X[7:9])

### 2.4 Stratified Random Subsets (X = population)
X <- 1:9
unname(t(expand.grid(X[1:3], X[4:6], X[7:9])))

### 2.5 Bias (E_T = estimated value(s), theta = actual value)
mean(E_T) - theta

### 2.6 MSE (E_T = estimated value(s), theta = actual value)
mse <- mean((E_T - theta)^2)

### 2.7 SE (E_T = estimated value(s), theta = actual value)
sqrt(mean((E_T - mean(E_T))^2))

################################################################################
############################## 4. Random Variables #############################
################################################################################

### 4.1 Bernoulli PMF (k = successes, n = observations, p = probability)
k <- 10
n <- 20
p <- 0.5
dbinom(k, size = n, prob = p)

### 4.2 Bernoulli CDF (k = successes, n = observations, p = probability)
k <- 10
n <- 20
p <- 0.5
pbinom(k, size = n, prob = p)

#### 4.3 Normal PDF (x = value, mu = mean, sigma = var)
x <- 1
mu <- 0
sigma <- 1
dnorm(x, mean = mu, sd = sqrt(sigma))

Written for

Institution
Study
Course

Document information

Uploaded on
January 2, 2022
Number of pages
5
Written in
2020/2021
Type
OTHER
Person
Unknown

Subjects

$6.03
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
tomdewildt Jheronimus Academy of Data Science
Follow You need to be logged in order to follow users or courses
Sold
29
Member since
4 year
Number of followers
13
Documents
22
Last sold
11 months ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions