Skip to content

Commit

Permalink
Start on updating Example code for VAT and Wealth
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamstark committed Sep 7, 2023
1 parent 88cccda commit db37f1a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
MarkdownTables = "1862ce21-31c7-451e-824c-f20fa3f90fa2"
Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
PovertyAndInequalityMeasures = "582645c0-90fa-497a-98b9-936b80116c29"
Expand Down
2 changes: 1 addition & 1 deletion src/ConsumptionData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const DEFAULT_STANDARD_RATE = default_standard_rate()
Match in the lcf data using the lookup table constructed in 'matching/lcf_frs_matching.jl'
'which' best, 2nd best etc match (<=20)
"""
function find_consumption_for_hh!( hh :: Household, case :: Int, dataset :: Int )
function find_consumption_for_hh!( hh :: Household, case :: Int, datayear :: Int )
# println( "find_consumption_for_hh! matching to case $case datayear $datayear")
hh.expenditure = EXPENDITURE_DATASET[(EXPENDITURE_DATASET.case .== case).&(EXPENDITURE_DATASET.datayear.==datayear),:][1,:]
hh.factor_costs = FACTOR_COST_DATASET[(FACTOR_COST_DATASET.case .== case).&(FACTOR_COST_DATASET.datayear.==datayear),:][1,:]
Expand Down
3 changes: 2 additions & 1 deletion src/MatchingLibs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module MatchingLibs
#
using ScottishTaxBenefitModel
using .Definitions,
.ModelHousehold,
.Uprating,
.RunSettings

Expand Down Expand Up @@ -967,7 +968,7 @@ function frs_tenuremap( tentyp2 :: Union{Int,Missing} ) :: Vector{Int}
return out
end

function model_tenuremap( t :: TenureType ) :: Vector{Int}
function model_tenuremap( t :: Tenure_Type ) :: Vector{Int}
return frs_tenuremap( Int( t ) )
end

Expand Down
4 changes: 2 additions & 2 deletions src/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ Make a new dataframe with the difference between the fields between
start_col and end_col and other fields just copied
diff is difference df2 - df1, Frames should have identical other cols.
"""
function df_diff( df1, df2 :: DataFrame, start_col::Int, end_col :: Int ) :: DataFrame
argch@eck size( df1 ) == size( df2 )
function df_diff( df1 :: DataFrame, df2 :: DataFrame, start_col :: Int, end_col :: Int ) :: DataFrame
@argcheck size( df1 ) == size( df2 )
## maybe check that the non diffed fields are all the same too..
d = copy(df1)
d[:,start_col:end_col] = df2[:,start_col:end_col] .- df1[:,start_col:end_col]
Expand Down
1 change: 1 addition & 0 deletions test/matching_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using .Utils:coarse_match

using DataFrames, CSV
using .ExampleHelpers
using .MatchingLibs

#
# Donor and Recipient each have 2 fields `a` and `b` filled with random
Expand Down

0 comments on commit db37f1a

Please sign in to comment.