This file contains hidden or 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 two-sided test compares the means of two samples coming from exponential distributions, and returns a p-value. | |
#It is generally more powerful than the Welch's t-test or the regular t-test, when sample sizes are equal. | |
#Avoid using it if sample sizes are unequal. | |
from scipy import stats | |
import numpy as np | |
import warnings | |
#Function to conduct the test | |
def f_test_expon_means(x, y): |
This file contains hidden or 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
#proof of concept for calculating a type M error (exaggeration ratio) for effect size in contingency tables | |
# type M error is defined as "The expectation of the absolute value of the estimate divided by the effect size, | |
# if statistically significantly different from zero." | |
# http://www.stat.columbia.edu/~gelman/research/published/retropower_final.pdf | |
type.m.error = function(samp.size, dof, real.w, alpha=0.05, power=0.8, n.sim=10000, seed=0) { | |
set.seed(seed) | |
chis = rchisq(n=n.sim, df=dof, ncp =samp.size*real.w^2 ) | |
crit.value = qchisq(p=alpha, df=dof, lower.tail=T) | |
chis = chis[chis >= crit.value] |
This file contains hidden or 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 adjustText import adjust_text | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
def plot_acm(model, data, x=0, y=1, dims = (11, 8), | |
keep_prefix=True, | |
adjust_labels=True): | |
''' | |
Parameters | |
---------- | |
model : prince.mca.MCA |
This file contains hidden or 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
""" | |
Python implementation of the פ (Fei) effect size for goodness-of-fit tests. | |
This is a beta version. Confidence intervals may differ from the original R implementation (see the "Returns" section below). | |
Reference: Ben-Shachar, M.S.; Patil, I.; Thériault, R.; Wiernik, B.M.; Lüdecke, D. Phi, Fei, Fo, Fum: Effect Sizes for Categorical Data That Use the Chi-Squared Statistic. Mathematics 2023, 11, 1982. https://doi.org/10.3390/math11091982 | |
For the original R implementation of Fei, see the "effectsize" library https://easystats.github.io/effectsize/reference/phi.html. | |
""" | |
from scipy.stats import chisquare, ncx2 | |
from scipy.optimize import least_squares | |
from collections import namedtuple |
This file contains hidden or 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
''' | |
Python dictionaries to convert ISCO-08 occupation codes to International Socio-Economic Index of occupational status (ISEI) values. | |
'isco_08_to_isei' is adapted from isqoisei08.sps from H. Ganzeboom's website. | |
'isco_08_to_isei_PISA' is an amended version of isco_08_to_isei, based on PISA 2018 technical report, | |
with 3 additional pseudo ISCO codes for stay-at-home people (9701), students (9702), and retired or unemployed people (9703). | |
References: | |
* “International Stratification and Mobility File: Conversion Tools.” Amsterdam: Department of Social Research Methodology, http://www.harryganzeboom.nl/ismf/index.htm. <Last revised: 2019/10/05> <Consulted on 24th April 2023>. | |
* OECD. (2018). Chapter 16 : Scaling procedures and construct validation of context questionnaire data. In PISA 2018 Technical Report. OECD Publishing. https://www.oecd.org/pisa/data/pisa2018technicalreport/PISA2018_Technical-Report-Chapter-16-Background-Questionnaires.pdf |
This file contains hidden or 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
#function to calculate Cohen's h (effect size for measuring distance between two proportions) | |
#https://en.wikipedia.org/wiki/Cohen's_h | |
import numpy as np | |
def cohenH(p1,p2): | |
phi1 = 2*np.arcsin(np.sqrt(p1)) | |
phi2 = 2*np.arcsin(np.sqrt(p2)) | |
h = phi1 - phi2 | |
return h |
This file contains hidden or 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 numpy as np | |
import pandas, os | |
root = r"C:\Documents\mes documents" #répertoire où se trouve le fichier. A modifier. | |
nom_fichier = "liste_complete.xlsx" #nom du fichier Excel contenant la liste complète que l'on souhaite découper | |
df = pandas.read_excel( | |
os.path.join(root, nom_fichier), #lire le fichier pour le traiter | |
header=None #Important : si les colonnes ont des intitulés (du type "nom", "prénom", etc.), supprimer « header="None" » de ce code. Sinon, si les colonnes n'ont pas d'intitulé, laisser "header=None" (autrement le script n'inclut pas la première ligne dans le tirage aléatoire). | |
) | |
df = df.sample(frac=1) #on mélange la liste aléatoirement | |
nb_de_groupes = 5 #changer cette valeur selon le nombre de groupes qu'on souhaite (ici 5, par exemple) |
This file contains hidden or 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
The following exhibition was Oggetti di poesia, dedicated to Emilio Villa. | |
A round table was also organized, featuring Nanni Balestrini, Paolo Fabbri, and Lamberto Pignotti. | |
After the transfer, Della Grazia continued to organize exhibitions and research. | |
In the same year the artist's books of ANS were lent to Deliberatamente. | |
La passione di un collezionista exhibition. | |
Ugo Carrega is an Italian artist and poet. | |
At the Centro Suolo, Carrega organized the first international exhibition of "advanced poetry". | |
The center closed down a few months later. | |
Sono importantissime in particolare le mostre Raccolta italiana di Nuova Scrittura e SCRITTURA ATTIVA. | |
Processi artistici di scrittura in dodici dimostrazioni ESpositive. |
This file contains hidden or 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
En mille sept cent quatre-vingt-quatorze, l'esclavage est aboli. | |
Olympe de Gouges est une des premières féministes françaises. | |
La viande de porc est marinée avec un mélange de piments, épices et ananas. | |
Il est alors recouvert de fromage à pàte pressée cuite préalablement rapé. | |
On y ajoute parfois également du jambon et/ou un œuf. | |
Le tout est ensuite passé au four pour cuisson. | |
Oignons grelot et cornichons au vinaigre constitue l'accompagnement le plus courant. | |
Dans le cas des yaourts, les ferments lactiques présents contribuent également à sa dégradationdeux. | |
Fruit d'un affinage assez court se distingue par son cerclage d'épicéaun. | |
Il fut suspendu en mille sept cent quatre-vingt-quinze par l'adoption du XIe amendement. |