Posts

Showing posts from October, 2022

‘A/B’ quality test or Z-test for the mean of a distribution

Image
  Some company would like to compare quality of service for call center workers in two different locations A and B. The service quality will be estimated as a quantity of solves issues during a day. The company randomly select 30 workers from call center A and 30 from B. So, average completed issues in A was 750 with standard deviation 20. And average completed issues in B was 780 with standard deviation 25. Requirement to estimate : Is the call center B shows statistically significant better service quality at statistical significance level 5%? We will use Z-test ( Wikipedia ) to compare two average of samples. The standard deviation is known and we assume samples with Normal distribution. Note: Z-test is valid for sample size from 30. Use Student's t-test instead for smaller sample sizes. Null hypothesis H0 - mean of A is equals to the mean of B. Call center A shows the same service quality as the call center B. Alternative hypothesis H1 - mean of A is NOT equals to the mean of B...

Market trades analytics with Jupyter/Pandas

Image
Import data from csv files with market trade data and execution time. Parse data and analyze market trades quality based on a price after 5 seconds. Calculate correlation between trade quality estimation and trade execution time delta. Python source code:  github.com import pandas as pd import re import numpy as np from matplotlib import pyplot as plt Market trades log "market_logs": trade timestamp in nanoseconds side: -1 sell +1 buy price volume book state: volume_bid@bid_price x ask_price@volume_ask In [2]: market_df = pd . read_csv ( "market_logs.log" , header = None ) market_df . shape Out[2]: (397802, 3) In [3]: print ( " \n " . join ( market_df . loc [ 0 ,:])) mLog: market trd at 1622505601191796236 with side -1 price 1108.9 traded volume 36 then book became 6@1108.7x1108.8@104 In [4]: def tm ( src : str ) -> int : '''parse timestamp''' res = re . findall ( "at (\d+) with" , ...