This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## packages | |
library(WeightIt) | |
library(mvnfast) | |
library(marginaleffects) | |
######## ATE | |
## function taken from the paper Sant'Anna, P. H., Song, X., & Xu, Q. (2022). Covariate distribution balance via propensity scores. Journal of Applied Econometrics, 37(6), 1093-1120. | |
## in particular from here: http://qed.econ.queensu.ca/jae/datasets/santanna001/ | |
cbps_sim_data <- function(n, dgp, scale.ps = 1, y_nonlin = FALSE){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("misclassGLM") | |
library("data.table") | |
library("simex") | |
## population definition | |
set.seed(2024) | |
N <- 100000 | |
pop_data <- data.table(age = sample(c("Young", "Middle-aged", "Old"), size = N, c(0.40, 0.35, 0.25), replace = T), | |
ethnic = sample(c("Native", "Nonnative"), size = N, prob = c(0.85, 0.15), replace = T)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(RcppHNSW) | |
library(rnndescent) | |
library(tokenizers) | |
library(text2vec) | |
library(igraph) | |
## read and process data | |
census <- read.csv("https://raw.githubusercontent.com/djvanderlaan/tutorial-reclin-uros2021/main/data/census.csv") | |
cis <- read.csv("https://raw.githubusercontent.com/djvanderlaan/tutorial-reclin-uros2021/main/data/cis.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(nonprobsvy) | |
seed_for_sim <- 2024 | |
set.seed(seed_for_sim) | |
## pop and sample sizes | |
N <- 100000 ## populacja | |
n_a <- N*0.7 ## proba big data o wielkosci 70% | |
n_b <- 10000 ## duza proba losowa | |
n_a1 <- 0.7 * n_a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ogolem": 51.5, | |
"wiek": { | |
"18-29-lat": 38.6, | |
"30-39-lat": 49.5, | |
"40-49-lat": 55.1, | |
"50-59-lat": 62.4, | |
"60-i-wiecej-lat": 51.4 | |
}, | |
"plec": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"NR": { | |
"PIS": { | |
"support": 1 | |
}, | |
"KONF": { | |
"support": 2 | |
}, | |
"TRZE": { | |
"support": 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"126101": { | |
"community": "Kraków", | |
"county": "", | |
"voivodeship": "", | |
"frequence": 50.1, | |
"result": [ | |
{ | |
"name": "Aleskander Miszalski", | |
"support": 39.4, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"support": { | |
"PIS": 33.7, | |
"KO": 31.9, | |
"TRZE": 13.5, | |
"KONF": 7.5, | |
"LEW": 6.8, | |
"BEZP": 2.7 | |
}, | |
"country": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"country": { | |
"frequence": 51.5 | |
}, | |
"voivods": { | |
"dolnoslaskie": { | |
"frequence": 48.3 | |
}, | |
"kujawsko-pomorskie": { | |
"frequence": 50.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"support": { | |
"PIS": 33.7, | |
"KONF": 7.5, | |
"TRZE": 13.5, | |
"LEW": 6.8, | |
"KO": 31.9, | |
"BEZP": 2.7, | |
"INNE": 3.9 | |
}, |
NewerOlder