Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
greimel committed Mar 4, 2022
1 parent 70bde71 commit 7e8f3f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DINA"
uuid = "2e9d5fb1-712f-4dff-9379-c18f12b3746d"
authors = ["Fabian Greimel <fabgrei@gmail.com> and contributors"]
version = "0.1.2"
version = "0.1.3"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand All @@ -16,10 +16,10 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TableOperations = "ab02a1b2-a7df-11e8-156e-fb1833f50b87"

[compat]
CategoricalArrays = "0.9"
CategoricalArrays = "0.10"
Chain = "0.4"
DataDeps = "0.7"
DataFrames = "0.22"
DataFrames = "1"
ReadableRegex = "0.3"
StatFiles = "0.8"
StatsBase = "0.33"
Expand Down
5 changes: 3 additions & 2 deletions src/DINA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ using DataDeps: register, DataDep, @datadep_str, unpack
using DataFrames: DataFrames, DataFrame, disallowmissing!,
groupby, combine, transform!, ByRow
using LinearAlgebra: dot
#using ProgressMeter: @showprogress
using ReadableRegex: look_for, one_or_more, DIGIT
using StatFiles: StatFiles, load
using StatsBase: wquantile
using StatsBase: quantile, weights
using TableOperations
using Statistics: mean

Expand Down Expand Up @@ -85,7 +86,7 @@ function aggregate_quantiles(var, byvar, ngroups, year; wgt, by_taxunit)
q = 0:1/ngroups:1

# Cut byvar into groups (e.g. income into deciles)
groups = cut(df[!,byvar], wquantile(df[!,byvar], df[!,wgt], q), extend=true, labels = format)
groups = cut(df[!,byvar], quantile(df[!,byvar], weights(df[!,wgt]), q), extend=true, labels = format)
df.group_id = parse.(Int, string.(groups))

# Aggregate by group
Expand Down

0 comments on commit 7e8f3f2

Please sign in to comment.