In [1]:
ENV["LINES"] = 10
ENV["COLUMNS"] = 60;
In [2]:
using DataFrames
benchmark = readtable(joinpath("data","benchmark.csv"), separator=';')
Out[2]:
In [3]:
longformat = melt(benchmark, [:Benchmark]) # Reshaping: wide -> long
Out[3]:
In [4]:
meantime = by(longformat, :variable, df -> mean( df[:value] )) # Split-Apply-Combine
Out[4]:
In [5]:
sort!(meantime, cols=[:x1]) # Sorting
names!(meantime, [:Lenguaje, :Tiempo_Medio])
Out[5]:
Descripción (estadística) del dataset (columnas), similar a summary
de R.
In [7]:
describe(meantime)
In [8]:
using RCall
In [9]:
ks = R"""ks.test($(benchmark[:Julia]), $(benchmark[:R]))"""
Out[9]:
In [10]:
rcopy(ks) # Transforma los datos de R a tipos de datos de Julia
Out[10]:
In [11]:
using HypothesisTests
In [12]:
ApproximateTwoSampleKSTest(benchmark[:Julia], benchmark[:R])
Out[12]:
In [13]:
SignedRankTest(
convert(Vector{Float64}, benchmark[:Julia]),
convert(Vector{Float64}, benchmark[:R])
) # Wilcoxon signed rank test
Out[13]:
In [14]:
using GLM
lineal = lm(R ~ Julia, benchmark)
Out[14]:
In [15]:
inter, pend = coef(lineal)
Out[15]:
In [20]:
using Plots
In [16]:
scatter(benchmark[:Julia], benchmark[:R], legend=false, xlab="Julia", ylab="R")
abline!(pend, inter)
Out[16]:
In [17]:
using Distributions
β = rand(Beta(2,2), 1000)
Out[17]:
In [18]:
# R"""
# install.packages("modeest")
# """
@rimport modeest as rmode
β_mode = rmode.hsm(β) # half-sample mode
Out[18]:
In [19]:
rcopy(β_mode)
Out[19]:
In [31]:
iris = readtable(joinpath("data", "iris.csv"))
Out[31]:
In [37]:
using Clustering
cl = kmeans(convert(Matrix{Float64}, iris[:, [:PetalWidth, :PetalLength]])', 3)
Out[37]:
In [35]:
cl.centers'
Out[35]:
In [36]:
by(iris, :Species, df -> (mean(df[:PetalWidth]), mean(df[:PetalLength])))
Out[36]:
In [ ]: