Act Now Julia
ActNow.analyse_w3_w4_changes
— MethodCreate a bunch of summaries of the differences between wave 3 and wave4 data
joined
- hcat of common wave3 and wave4 datawave3
- wave3 datawave4
- wave4 data- return dict of images and summary stats for the stacked data and counts for w3 and w4
ActNow.build_trust
— Methodreturn 24 (most) .. 0 least
ActNow.corrmatrix
— FunctionCorrelation matrix for the policies
ActNow.create_all_crosstabs
— MethodWrites images of each crosstab to e.g. img/crosstab-[policyname]-by-gender.svg
index_filename
- index file for all the links to imagesdall
- one of w4 or w3 processed datasets (see metaload for steps)
TODO: more breakdowns - switch between .png
.svg
ActNow.create_one!
— MethodThis convoluted function creates a bunch or binary variables in the dataframe dall
for some question and treatments. @param labels
- for readable variable names e.g. "basicincome" @param initialq
- initial opinion on the thing @param finalq
- final (post explanation) opinion @param treatqs
- three strings representing the 3 explanations for that thing - abs gains, rel gains, security adds in variables like `basicincometreatabsgains_destitute`
ActNow.do_basic_pca_w
— MethodSee: https://juliastats.org/MultivariateStats.jl/dev/pca/#Linear-Principal-Component-Analysis See: https://www.youtube.com/watch?v=FgakZw6K1QQ
ActNow.do_fixed_effects
— MethodW3->4 Fixed effect regs written to: output/fixed-effect-regs.html
ActNow.draw_change_scat
— MethodDraw our scatter plots with the parties colo[u]red in.
ActNow.draw_pol_scat
— MethodDraw our scatter plots with the parties colo[u]red in.
ActNow.draw_policies2
— MethodDrawing all our charts using the marginally less mad AlgebraOfGraphics lib.
ActNow.joinv3v4
— MethodMerge wave3 and wave4 data on PROLIFIC_ID
. return horizontally joined, vertically stacked and a list of items to skip in subsequent regressions if log incomes are NaNs Also, add in_both_waves
field to wave4 as a by-product.
ActNow.make_all_graphs
— MethodMake a bunch of scatterplots for each policy - see draw_policies2
Written to output/img
as both .svg
and .png
ActNow.make_big_file_by_explanvar
— MethodCreates all_results_by_explanvar.html
with most results broken down by risk of destitution, health, life ladder, etc. -See MAIN_EXPLANDICT
for the whole list.
ActNow.make_big_file_by_policy
— MethodMakes output/all_results_by_policy.html
, a big file summarising main wave 4 results, organised by each policy area.
run_regressions()
and make_and_print_summarystats()
need to have been run beforehand and the output
directory filled with regressiona and graph files.
ActNow.make_dataset_v4
— MethodInitial load and construction of v4 dataset with extra created variables.
ActNow.make_summarystats
— MethodMake a pile of summary statistics and histograms
ActNow.merge_treats!
— MethodProduce a single column with which treatment and the score
ActNow.pform
— MethodHacky p-values cols in stats tables.
ActNow.policies_as_matrix
— Methoddall - extension - pre or post normalise -
ActNow.recode_income
— MethodHacky fix of income where some people seem to have entered in £000s rather than £s
ActNow.recode_party
— MethodFIXME mess
ActNow.reweight
— FunctionCreate weights based on voting intention and age/sex groups. NOTE: 0.6-2.8 are the closesy weights I can find that converge using constrainedchisquare.
ActNow.run_regressions_by_policy
— MethodTake 2 - slightly different regressions and tables organised by policy
ActNow.summarise_pca
— FunctionSummary of one of our Principal Components
dall
- wave3 or 4 dataset (always 4 in practice)- M - output from one PCA analysys (?? type ??)
- extension - one of 'pre' or 'change'
- regdir - where to save regressions