Professional Documents
Culture Documents
Applied Statistics - Descriptive Measures
Applied Statistics - Descriptive Measures
In R, the range() function returns a vector containing the minimum and maximum of all given values, so NOT our range
To get our range, we need to subtract the 2 results (max – min)
range (c(7, 8, 9, 10, 11, 12)) r <- range (c(1, 2, 10, 30, 50, 99, 100))
[1] 7 12 Range <- r[2] - r[1]
Range
[1] 99
The result is min value and max value
r <- range (c(NA, 8, 9, 10, 11, NA))
Let´s define a vector for the results, and then it´s
[1] NA NA
possible to calculate the range: Range
[1] NA
?
Calculate the range of r
1. x <- c(NA, 1:3, -1:1/0) [1] 8 11
2. Cars93$Price Range <- r[2] - r[1]
3. Interruptions Range
[1] 3
Furtwangen University 2
Measures for Variation, the Range
Solutions
∰
x <- c(NA, 1:3, -1:1/0) x <- Cars93$Price x <- interruptions$Interruptions
x r <- range(x) r <- range(x)
[1] NA 1 2 3 -Inf NaN Inf Range <- r[2] - r[1] Range <- r[2] - r[1]
r <- range(x) Range Range
Range <- r[2] - r[1] [1] 54.5 [1] 5
Range
[1] NA
Furtwangen University 3
Measures for Variation, Coefficient of Variation
install.packages("DescTools")
library(DescTools)
Furtwangen University 4
Measures for Variation, Coefficient of Variation
Solutions
∰
a) CoefVar(interruptions$Interruptions)
[1] 1.172689
Furtwangen University 5