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
#%% | |
from google.cloud import translate_v2 | |
from googletrans import Translator | |
import os | |
from pathlib import Path | |
import pandas as pd | |
# %% | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] ="/home/alal/keys/sandbox-7f8884d01b79.json" | |
translate_client = translate_v2.Client() |
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(alpaca); library(fixest) | |
# %% #################################################### | |
data(psid, package = "bife") | |
head(psid) | |
# %% https://cran.r-project.org/web/packages/alpaca/vignettes/howto.html | |
stat <- alpaca::feglm(LFP ~ KID1 + KID2 + KID3 + log(INCH) | ID + TIME, psid, binomial("probit")) | |
# Fernandez-Val + Weidner bias correction - https://www-sciencedirect-com.stanford.idm.oclc.org/science/article/pii/S0304407615002997?via%3Dihub | |
stat.bc <- biasCorr(stat) |
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
# %% #################################################### | |
rm(list = ls()) | |
library(LalRUtils) | |
LalRUtils::libreq(tidyverse, data.table, fst, collapse, fixest, rio, foreach, magrittr, | |
janitor, tictoc, modelsummary, hablar, patchwork, RPushbullet, IRdisplay, | |
did, panelView) | |
theme_set(lal_plot_theme()) # add _d() for dark | |
options(repr.plot.width=12, repr.plot.height=9) | |
options(ggplot2.discrete.fill = RColorBrewer::brewer.pal(7, "Set2")) | |
options(ggplot2.discrete.colour = RColorBrewer::brewer.pal(7, "Set2")) |
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
import pandas as pd | |
import sqlite3 | |
# %% | |
Cars = {'Brand': ['Honda Civic','Toyota Corolla','Ford Focus','Audi A4'], | |
'Price': [22000,25000,27000,35000] | |
} | |
df = pd.DataFrame(Cars, columns= ['Brand', 'Price']) | |
print (df) |
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
# This file may be used to create an environment using: | |
# $ conda create --name <env> --file <this file> | |
# platform: linux-64 | |
@EXPLICIT | |
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 | |
https://repo.anaconda.com/pkgs/main/linux-64/blas-1.0-openblas.tar.bz2 | |
https://repo.anaconda.com/pkgs/main/linux-64/ca-certificates-2020.6.24-0.conda | |
https://repo.anaconda.com/pkgs/main/linux-64/ld_impl_linux-64-2.33.1-h53a641e_7.conda | |
https://repo.anaconda.com/pkgs/main/linux-64/libgfortran-ng-7.3.0-hdf63c60_0.conda | |
https://repo.anaconda.com/pkgs/main/linux-64/libstdcxx-ng-9.1.0-hdf63c60_0.conda |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
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
"","Package","LibPath","Version","Priority","Depends","Imports","LinkingTo","Suggests","Enhances","License","License_is_FOSS","License_restricts_use","OS_type","MD5sum","NeedsCompilation","Built" | |
"abind","abind","/home/alal/R/x86_64-pc-linux-gnu-library/3.6","1.4-5",NA,"R (>= 1.5.0)","methods, utils",NA,NA,NA,"LGPL (>= 2)",NA,NA,NA,NA,"no","3.6.2" | |
"acepack","acepack","/home/alal/R/x86_64-pc-linux-gnu-library/3.6","1.4.1",NA,NA,NA,NA,"testthat",NA,"MIT + file LICENSE",NA,NA,NA,NA,"yes","3.6.2" | |
"AER","AER","/home/alal/R/x86_64-pc-linux-gnu-library/3.6","1.2-9",NA,"R (>= 3.0.0), car (>= 2.0-19), lmtest, sandwich (>= 2.4-0), | |
survival (>= 2.37-5), zoo","stats, Formula (>= 0.2-0)",NA,"boot, dynlm, effects, fGarch, forecast, foreign, ineq, | |
KernSmooth, lattice, longmemo, MASS, mlogit, nlme, nnet, np, | |
plm, pscl, quantreg, rgl, ROCR, rugarch, sampleSelection, | |
scatterplot3d, strucchange, systemfit (>= 1.1-20), truncreg, | |
tseries, urca, vars",NA,"GPL-2 | GPL-3",NA,NA,NA,NA,"no","3.6.2" | |
"alpaca","alpaca","/home/alal/R/x86_ |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
*! v0.1 Apoorva Lal | |
// returns dataset with dataset's <describe> output | |
// useful for very wide datasets / datasets with useless/uninformative | |
// variable names | |
// e.g. USAID's Demographic and Health Surveys | |
pr define varlabelbook | |
syntax [anything] | |
qui compress | |
qui ds `anything' |
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
#!/bin/bash | |
#SBATCH --job-name=cron | |
#SBATCH --begin=now | |
#SBATCH --dependency=singleton | |
#SBATCH --time=00:02:00 | |
#SBATCH -p hns | |
#SBATCH --mem-per-cpu=4GB | |
#SBATCH --mail-type=FAIL | |
# module loads |