#================================================================================================================# #========== Jacek Wallusch ==========# #========== MBA: Introduction to Pricing Analytics ==========# #========== Introduction to Programming in R Language and Desciptive Statistics ==========# #================================================================================================================# #----- DATA # data file audiq5 <- read.csv("C:/Users/SESA387551/Documents/Lehre/Wintersemester-2016/audiq5.csv", header=TRUE, sep = ";") # price AQ5_pr <- audiq5[,4] AQ5_cc <- audiq5[,2] # defining additional variable AQ5_2L <- AQ5_pr[which(AQ5_cc == 2000)] #----- PACKAGES library(fBasics) #----- Average mean(AQ5_pr) mean(AQ5_2L) #----- Std. Deviation sd(AQ5_pr) sd(AQ5_2L) #----- Skewness skewness(AQ5_pr, method = c("moment")) skewness(AQ5_pr, method = c("fisher")) skewness(AQ5_2L, method = c("moment")) skewness(AQ5_2L, method = c("fisher")) #----- Kurtosis kurtosis(AQ5_pr, method = c("excess")) kurtosis(AQ5_pr, method = c("moment")) kurtosis(AQ5_pr, method = c("fisher")) kurtosis(AQ5_2L, method = c("excess")) kurtosis(AQ5_2L, method = c("moment")) kurtosis(AQ5_2L, method = c("fisher")) #----- Histogram hist(AQ5_pr, freq = FALSE) hist(AQ5_2L, freq = FALSE) # extracting the data: [1] counts for bins [2] densities for bins [3] midpoints for bins hist(AQ5_pr)$counts hist(AQ5_pr)$density hist(AQ5_pr)$mids #----- Kernel Density # summary table density(AQ5_pr) # basic graph plot(density(AQ5_pr)) # extracting the data density(AQ5_pr)$x density(AQ5_pr)$y # using PLOTLY-package to graph the kernel density plot_ly(x = density(AQ5_pr)$x, y = density(AQ5_pr)$y, type = "scatter", mode = "lines")