{
  "equilibrium": {
    "python": {
      "baseline": {
        "api": "equilibrium",
        "variant": "baseline",
        "language": "python",
        "codeFile": "econ23-code/equilibrium-baseline.py",
        "codeSHA256": "0fdf11394d7375fe1d3031e072e6796e0e32a5d9f2243c3bdf1b7c5478125b99",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='equilibrium'\nINPUT={'demandIntercept': 100, 'supplyIntercept': 20, 'demandSlope': 2, 'supplySlope': 2}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='equilibrium'\nINPUT={'demandIntercept': 100, 'supplyIntercept': 20, 'demandSlope': 2, 'supplySlope': 2}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "demandIntercept": 100,
          "supplyIntercept": 20,
          "demandSlope": 2,
          "supplySlope": 2
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "price=20.000000000, quantity=60.000000000\n",
        "stderr": "",
        "summary": {
          "price": "20.000000000",
          "quantity": "60.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "100",
            "series": "Demand"
          },
          {
            "x": "0",
            "y": "20",
            "series": "Supply"
          },
          {
            "x": "5",
            "y": "90",
            "series": "Demand"
          },
          {
            "x": "5",
            "y": "30",
            "series": "Supply"
          },
          {
            "x": "10",
            "y": "80",
            "series": "Demand"
          },
          {
            "x": "10",
            "y": "40",
            "series": "Supply"
          },
          {
            "x": "15",
            "y": "70",
            "series": "Demand"
          },
          {
            "x": "15",
            "y": "50",
            "series": "Supply"
          },
          {
            "x": "20",
            "y": "60",
            "series": "Demand"
          },
          {
            "x": "20",
            "y": "60",
            "series": "Supply"
          },
          {
            "x": "25",
            "y": "50",
            "series": "Demand"
          },
          {
            "x": "25",
            "y": "70",
            "series": "Supply"
          },
          {
            "x": "30",
            "y": "40",
            "series": "Demand"
          },
          {
            "x": "30",
            "y": "80",
            "series": "Supply"
          },
          {
            "x": "35",
            "y": "30",
            "series": "Demand"
          },
          {
            "x": "35",
            "y": "90",
            "series": "Supply"
          },
          {
            "x": "40",
            "y": "20",
            "series": "Demand"
          },
          {
            "x": "40",
            "y": "100",
            "series": "Supply"
          }
        ],
        "plotFile": "econ23-fixed-results/equilibrium-baseline-python/plot.svg",
        "plotSHA256": "a15ecd7a0a62dce3e7abf3a7c923497a140c21395aed15ce2fc6a9bd37ebe4d5",
        "files": [
          {
            "file": "econ23-fixed-results/equilibrium-baseline-python/full.json",
            "sha256": "5b81861e4a0d3644b50de554315bb20020478e2bb7c0c001c881959969ffe914"
          },
          {
            "file": "econ23-fixed-results/equilibrium-baseline-python/plot-points.csv",
            "sha256": "25808ab94f8e484d8cd5625b2b63255eb6da7ac43691e83a941c6e626c3d91ab"
          },
          {
            "file": "econ23-fixed-results/equilibrium-baseline-python/plot.svg",
            "sha256": "a15ecd7a0a62dce3e7abf3a7c923497a140c21395aed15ce2fc6a9bd37ebe4d5"
          },
          {
            "file": "econ23-fixed-results/equilibrium-baseline-python/summary.csv",
            "sha256": "74157fe22ebad7470fc6cf2b5cfd048ee92f1c7e12f42ca9165d28e0692a7a20"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "demand-shift": {
        "api": "equilibrium",
        "variant": "demand-shift",
        "language": "python",
        "codeFile": "econ23-code/equilibrium-demand-shift.py",
        "codeSHA256": "b31f9150272703f33f7dd7b8494e2594ea47afeecc435ee752fa1d9e6df606df",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='equilibrium'\nINPUT={'demandIntercept': 100, 'supplyIntercept': 20, 'demandSlope': 2, 'supplySlope': 2, 'demandShifter': 20}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='equilibrium'\nINPUT={'demandIntercept': 100, 'supplyIntercept': 20, 'demandSlope': 2, 'supplySlope': 2, 'demandShifter': 20}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "demandIntercept": 100,
          "supplyIntercept": 20,
          "demandSlope": 2,
          "supplySlope": 2,
          "demandShifter": 20
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "price=25.000000000, quantity=70.000000000\n",
        "stderr": "",
        "summary": {
          "price": "25.000000000",
          "quantity": "70.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "120",
            "series": "Demand"
          },
          {
            "x": "0",
            "y": "20",
            "series": "Supply"
          },
          {
            "x": "5",
            "y": "110",
            "series": "Demand"
          },
          {
            "x": "5",
            "y": "30",
            "series": "Supply"
          },
          {
            "x": "10",
            "y": "100",
            "series": "Demand"
          },
          {
            "x": "10",
            "y": "40",
            "series": "Supply"
          },
          {
            "x": "15",
            "y": "90",
            "series": "Demand"
          },
          {
            "x": "15",
            "y": "50",
            "series": "Supply"
          },
          {
            "x": "20",
            "y": "80",
            "series": "Demand"
          },
          {
            "x": "20",
            "y": "60",
            "series": "Supply"
          },
          {
            "x": "25",
            "y": "70",
            "series": "Demand"
          },
          {
            "x": "25",
            "y": "70",
            "series": "Supply"
          },
          {
            "x": "30",
            "y": "60",
            "series": "Demand"
          },
          {
            "x": "30",
            "y": "80",
            "series": "Supply"
          },
          {
            "x": "35",
            "y": "50",
            "series": "Demand"
          },
          {
            "x": "35",
            "y": "90",
            "series": "Supply"
          },
          {
            "x": "40",
            "y": "40",
            "series": "Demand"
          },
          {
            "x": "40",
            "y": "100",
            "series": "Supply"
          }
        ],
        "plotFile": "econ23-fixed-results/equilibrium-demand-shift-python/plot.svg",
        "plotSHA256": "a09b5643724439a6bf83459c75ecede3bad9ea437a5a26b5647a76ec22bc01ae",
        "files": [
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-python/full.json",
            "sha256": "56b26b5656a3cc6664fbd97029c191e0954eceacc640efccb226d3599f7731b8"
          },
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-python/plot-points.csv",
            "sha256": "b18ff065a9b9820fcebdd3e5f766cc115c0180b002a7f26411f60f83370a0bce"
          },
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-python/plot.svg",
            "sha256": "a09b5643724439a6bf83459c75ecede3bad9ea437a5a26b5647a76ec22bc01ae"
          },
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-python/summary.csv",
            "sha256": "864be20dbf40a8249252fd54ce7fa9b75c5fe720786b1270cf3c96633376a363"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "reject-null": {
        "api": "equilibrium",
        "variant": "reject-null",
        "language": "python",
        "codeFile": "econ23-code/equilibrium-reject-null.py",
        "codeSHA256": "eac8d14b2a8bb5ec1a2d12a665cf60eb791bf5ab9c4bcfe368bea8b7d636d80f",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='equilibrium'\nINPUT={'demandIntercept': 100, 'supplyIntercept': 20, 'demandSlope': 2, 'supplySlope': 2, 'demandShifter': None}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='equilibrium'\nINPUT={'demandIntercept': 100, 'supplyIntercept': 20, 'demandSlope': 2, 'supplySlope': 2, 'demandShifter': None}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "demandIntercept": 100,
          "supplyIntercept": 20,
          "demandSlope": 2,
          "supplySlope": 2,
          "demandShifter": null
        },
        "returnCode": 2,
        "expectedFailure": true,
        "stdout": "",
        "stderr": "Rejected declared input: explicit null is not a numeric parameter\n",
        "summary": {},
        "plotPoints": [],
        "plotFile": null,
        "plotSHA256": null,
        "files": [],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    },
    "r": {
      "baseline": {
        "api": "equilibrium",
        "variant": "baseline",
        "language": "r",
        "codeFile": "econ23-code/equilibrium-baseline.R",
        "codeSHA256": "41a59a7660d7364ee00ad53a1e607e44c5ad39ffe5166ea6e027805e145d5798",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"equilibrium\"\nINPUT<-list(demandIntercept=100,supplyIntercept=20,demandSlope=2,supplySlope=2)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"equilibrium\"\nINPUT<-list(demandIntercept=100,supplyIntercept=20,demandSlope=2,supplySlope=2)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [],
        "input": {
          "demandIntercept": 100,
          "supplyIntercept": 20,
          "demandSlope": 2,
          "supplySlope": 2
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "price=20.000000000, quantity=60.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "price": "20.000000000",
          "quantity": "60.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "100",
            "series": "Demand"
          },
          {
            "x": "0",
            "y": "20",
            "series": "Supply"
          },
          {
            "x": "5",
            "y": "90",
            "series": "Demand"
          },
          {
            "x": "5",
            "y": "30",
            "series": "Supply"
          },
          {
            "x": "10",
            "y": "80",
            "series": "Demand"
          },
          {
            "x": "10",
            "y": "40",
            "series": "Supply"
          },
          {
            "x": "15",
            "y": "70",
            "series": "Demand"
          },
          {
            "x": "15",
            "y": "50",
            "series": "Supply"
          },
          {
            "x": "20",
            "y": "60",
            "series": "Demand"
          },
          {
            "x": "20",
            "y": "60",
            "series": "Supply"
          },
          {
            "x": "25",
            "y": "50",
            "series": "Demand"
          },
          {
            "x": "25",
            "y": "70",
            "series": "Supply"
          },
          {
            "x": "30",
            "y": "40",
            "series": "Demand"
          },
          {
            "x": "30",
            "y": "80",
            "series": "Supply"
          },
          {
            "x": "35",
            "y": "30",
            "series": "Demand"
          },
          {
            "x": "35",
            "y": "90",
            "series": "Supply"
          },
          {
            "x": "40",
            "y": "20",
            "series": "Demand"
          },
          {
            "x": "40",
            "y": "100",
            "series": "Supply"
          }
        ],
        "plotFile": "econ23-fixed-results/equilibrium-baseline-r/plot.svg",
        "plotSHA256": "6256e1ea5eb4194803a854ea7763c8d9f9849df5b4ca4becfab92f3e81b6d615",
        "files": [
          {
            "file": "econ23-fixed-results/equilibrium-baseline-r/full-result.Rtext",
            "sha256": "02dd0940cc15e46e841bfe108e0b65b1ba4a7f82ea7efbe3d44d32d808a67598"
          },
          {
            "file": "econ23-fixed-results/equilibrium-baseline-r/plot-points.csv",
            "sha256": "2bd994ab13c3c4de384bfd19737109781193d78cd2d7babfefc421a99006d463"
          },
          {
            "file": "econ23-fixed-results/equilibrium-baseline-r/plot.svg",
            "sha256": "6256e1ea5eb4194803a854ea7763c8d9f9849df5b4ca4becfab92f3e81b6d615"
          },
          {
            "file": "econ23-fixed-results/equilibrium-baseline-r/summary.csv",
            "sha256": "3c1b297496651d06ef009f46aa446b384faf95d83d236c5a39a0eb050a97a055"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "demand-shift": {
        "api": "equilibrium",
        "variant": "demand-shift",
        "language": "r",
        "codeFile": "econ23-code/equilibrium-demand-shift.R",
        "codeSHA256": "05bd1babec2d762028021611edbe33f5c5ea8620f6ae424457708c33aaf33ea6",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"equilibrium\"\nINPUT<-list(demandIntercept=100,supplyIntercept=20,demandSlope=2,supplySlope=2,demandShifter=20)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"equilibrium\"\nINPUT<-list(demandIntercept=100,supplyIntercept=20,demandSlope=2,supplySlope=2,demandShifter=20)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [],
        "input": {
          "demandIntercept": 100,
          "supplyIntercept": 20,
          "demandSlope": 2,
          "supplySlope": 2,
          "demandShifter": 20
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "price=25.000000000, quantity=70.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "price": "25.000000000",
          "quantity": "70.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "120",
            "series": "Demand"
          },
          {
            "x": "0",
            "y": "20",
            "series": "Supply"
          },
          {
            "x": "5",
            "y": "110",
            "series": "Demand"
          },
          {
            "x": "5",
            "y": "30",
            "series": "Supply"
          },
          {
            "x": "10",
            "y": "100",
            "series": "Demand"
          },
          {
            "x": "10",
            "y": "40",
            "series": "Supply"
          },
          {
            "x": "15",
            "y": "90",
            "series": "Demand"
          },
          {
            "x": "15",
            "y": "50",
            "series": "Supply"
          },
          {
            "x": "20",
            "y": "80",
            "series": "Demand"
          },
          {
            "x": "20",
            "y": "60",
            "series": "Supply"
          },
          {
            "x": "25",
            "y": "70",
            "series": "Demand"
          },
          {
            "x": "25",
            "y": "70",
            "series": "Supply"
          },
          {
            "x": "30",
            "y": "60",
            "series": "Demand"
          },
          {
            "x": "30",
            "y": "80",
            "series": "Supply"
          },
          {
            "x": "35",
            "y": "50",
            "series": "Demand"
          },
          {
            "x": "35",
            "y": "90",
            "series": "Supply"
          },
          {
            "x": "40",
            "y": "40",
            "series": "Demand"
          },
          {
            "x": "40",
            "y": "100",
            "series": "Supply"
          }
        ],
        "plotFile": "econ23-fixed-results/equilibrium-demand-shift-r/plot.svg",
        "plotSHA256": "4f3c4967bcd13dc2236dd1188719bc4821014eac888afedf36c22f1c1511aaad",
        "files": [
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-r/full-result.Rtext",
            "sha256": "e981c561aa427642b9dd665a822eedf57b98b00a7f68e4f7bf412fb29a7c3ef6"
          },
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-r/plot-points.csv",
            "sha256": "0f8d04ce87fd5231fd19244330f4dcdd3c60650dd2de82474275e7c1f23dc2ed"
          },
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-r/plot.svg",
            "sha256": "4f3c4967bcd13dc2236dd1188719bc4821014eac888afedf36c22f1c1511aaad"
          },
          {
            "file": "econ23-fixed-results/equilibrium-demand-shift-r/summary.csv",
            "sha256": "9a9d2aa5f07b8be2cb878998a1a00b695b6acffa32d80f9ab57aa9cc190ab745"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "reject-null": {
        "api": "equilibrium",
        "variant": "reject-null",
        "language": "r",
        "codeFile": "econ23-code/equilibrium-reject-null.R",
        "codeSHA256": "8e588ed8cbced8acaaec1a6d8110c64f8fce91729d293a91ee9873d5060a1ced",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"equilibrium\"\nINPUT<-list(demandIntercept=100,supplyIntercept=20,demandSlope=2,supplySlope=2,demandShifter=NULL)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"equilibrium\"\nINPUT<-list(demandIntercept=100,supplyIntercept=20,demandSlope=2,supplySlope=2,demandShifter=NULL)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [],
        "input": {
          "demandIntercept": 100,
          "supplyIntercept": 20,
          "demandSlope": 2,
          "supplySlope": 2,
          "demandShifter": null
        },
        "returnCode": 2,
        "expectedFailure": true,
        "stdout": "",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \nRejected declared input:  explicit null is not a numeric parameter \n",
        "summary": {},
        "plotPoints": [],
        "plotFile": null,
        "plotSHA256": null,
        "files": [],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    }
  },
  "reducedForm": {
    "python": {
      "valid": {
        "api": "reducedForm",
        "variant": "valid",
        "language": "python",
        "codeFile": "econ23-code/reducedForm-valid.py",
        "codeSHA256": "ae6cd8b1f764bf6114a8f6daf20ba7f6f324a4e90c3d98d3cdbf67a9a7f7dc75",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='reducedForm'\nINPUT={'firstStageSlope': 2, 'causalSlope': 3}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='reducedForm'\nINPUT={'firstStageSlope': 2, 'causalSlope': 3}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "firstStageSlope": 2,
          "causalSlope": 3
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "projectionFirstStage=2.000000000, projectionReducedForm=6.000000000, ivRatio=3.000000000, olsSlope=3.000000000\n",
        "stderr": "",
        "summary": {
          "projectionFirstStage": "2.000000000",
          "projectionReducedForm": "6.000000000",
          "ivRatio": "3.000000000",
          "olsSlope": "3.000000000"
        },
        "plotPoints": [
          {
            "x": "-2",
            "y": "-12",
            "series": "Structural path V=U=0"
          },
          {
            "x": "-1",
            "y": "-6",
            "series": "Structural path V=U=0"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Structural path V=U=0"
          },
          {
            "x": "1",
            "y": "6",
            "series": "Structural path V=U=0"
          },
          {
            "x": "2",
            "y": "12",
            "series": "Structural path V=U=0"
          }
        ],
        "plotFile": "econ23-fixed-results/reducedForm-valid-python/plot.svg",
        "plotSHA256": "147153f9011cc0fab9174aa220887c05b3f22ef8b7be5ab8c580fd3107183454",
        "files": [
          {
            "file": "econ23-fixed-results/reducedForm-valid-python/full.json",
            "sha256": "ac0651c5637dbf191e91b5d0fc53fefc86268b8b8c6b74e42e74053284d86a7b"
          },
          {
            "file": "econ23-fixed-results/reducedForm-valid-python/plot-points.csv",
            "sha256": "3d2ffc30b74268fcea5ae89c53137a52283ec60b4ddfdcee0e524f9504651602"
          },
          {
            "file": "econ23-fixed-results/reducedForm-valid-python/plot.svg",
            "sha256": "147153f9011cc0fab9174aa220887c05b3f22ef8b7be5ab8c580fd3107183454"
          },
          {
            "file": "econ23-fixed-results/reducedForm-valid-python/summary.csv",
            "sha256": "ff7d4b71f93b1b4de14e84041f3c388eb1c91e3e3c7e3cd1b73c3bea17c9b00d"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "exclusion": {
        "api": "reducedForm",
        "variant": "exclusion",
        "language": "python",
        "codeFile": "econ23-code/reducedForm-exclusion.py",
        "codeSHA256": "f3a557f609401303281d42d9db55651cdb95b39fc0812f138a47ac816a7706da",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='reducedForm'\nINPUT={'firstStageSlope': 2, 'causalSlope': 3, 'directInstrumentEffect': 1}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='reducedForm'\nINPUT={'firstStageSlope': 2, 'causalSlope': 3, 'directInstrumentEffect': 1}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "firstStageSlope": 2,
          "causalSlope": 3,
          "directInstrumentEffect": 1
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "projectionFirstStage=2.000000000, projectionReducedForm=7.000000000, ivRatio=3.500000000, olsSlope=3.400000000\n",
        "stderr": "",
        "summary": {
          "projectionFirstStage": "2.000000000",
          "projectionReducedForm": "7.000000000",
          "ivRatio": "3.500000000",
          "olsSlope": "3.400000000"
        },
        "plotPoints": [
          {
            "x": "-2",
            "y": "-14",
            "series": "Structural path V=U=0"
          },
          {
            "x": "-1",
            "y": "-7",
            "series": "Structural path V=U=0"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Structural path V=U=0"
          },
          {
            "x": "1",
            "y": "7",
            "series": "Structural path V=U=0"
          },
          {
            "x": "2",
            "y": "14",
            "series": "Structural path V=U=0"
          }
        ],
        "plotFile": "econ23-fixed-results/reducedForm-exclusion-python/plot.svg",
        "plotSHA256": "708bb19aec2ee1a10982bdf80029dd5b8070e18160b59ba17f8114eb1710f6dc",
        "files": [
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-python/full.json",
            "sha256": "4619c2f3c819d248f919ccbeef937f0e38d01c4342b89e00bec40bede8e0c7ef"
          },
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-python/plot-points.csv",
            "sha256": "f8b84ab7d7d223ad623242a74814f86ddc432c8df5089ac7bc5a16ecc9721ab1"
          },
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-python/plot.svg",
            "sha256": "708bb19aec2ee1a10982bdf80029dd5b8070e18160b59ba17f8114eb1710f6dc"
          },
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-python/summary.csv",
            "sha256": "671408b6ce901793aba85916d4dba1a10c5e5248368fb844f518f0597f0e24eb"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    },
    "r": {
      "valid": {
        "api": "reducedForm",
        "variant": "valid",
        "language": "r",
        "codeFile": "econ23-code/reducedForm-valid.R",
        "codeSHA256": "3628d0285297a29ecbba3a9083371b325803c10bc0d0b6da0bfccc5626231119",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"reducedForm\"\nINPUT<-list(firstStageSlope=2,causalSlope=3)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"reducedForm\"\nINPUT<-list(firstStageSlope=2,causalSlope=3)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [],
        "input": {
          "firstStageSlope": 2,
          "causalSlope": 3
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "projectionFirstStage=2.000000000, projectionReducedForm=6.000000000, ivRatio=3.000000000, olsSlope=3.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "projectionFirstStage": "2.000000000",
          "projectionReducedForm": "6.000000000",
          "ivRatio": "3.000000000",
          "olsSlope": "3.000000000"
        },
        "plotPoints": [
          {
            "x": "-2",
            "y": "-12",
            "series": "Structural path V=U=0"
          },
          {
            "x": "-1",
            "y": "-6",
            "series": "Structural path V=U=0"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Structural path V=U=0"
          },
          {
            "x": "1",
            "y": "6",
            "series": "Structural path V=U=0"
          },
          {
            "x": "2",
            "y": "12",
            "series": "Structural path V=U=0"
          }
        ],
        "plotFile": "econ23-fixed-results/reducedForm-valid-r/plot.svg",
        "plotSHA256": "f91160eeea1980067a7050b339c33c6ab2f244755c0c4b32c8a88acd304efeec",
        "files": [
          {
            "file": "econ23-fixed-results/reducedForm-valid-r/full-result.Rtext",
            "sha256": "ad8fb09440843a07e1da0af82da3c377e5d65891cb8511149491593b90931e5c"
          },
          {
            "file": "econ23-fixed-results/reducedForm-valid-r/plot-points.csv",
            "sha256": "25617390058c6632bcd031b3a28c55aa714d52ebf68dfc8c963397f05fece6f5"
          },
          {
            "file": "econ23-fixed-results/reducedForm-valid-r/plot.svg",
            "sha256": "f91160eeea1980067a7050b339c33c6ab2f244755c0c4b32c8a88acd304efeec"
          },
          {
            "file": "econ23-fixed-results/reducedForm-valid-r/summary.csv",
            "sha256": "c6e401af3bbba54f0bad0956bac05a597569c5b61af4f3ce8c5c07fb5cd7e0f0"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "exclusion": {
        "api": "reducedForm",
        "variant": "exclusion",
        "language": "r",
        "codeFile": "econ23-code/reducedForm-exclusion.R",
        "codeSHA256": "f2f00563b4e2047887a1e1a3b242893aeb3e16d414df0d3ac7731649c39a9fa3",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"reducedForm\"\nINPUT<-list(firstStageSlope=2,causalSlope=3,directInstrumentEffect=1)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"reducedForm\"\nINPUT<-list(firstStageSlope=2,causalSlope=3,directInstrumentEffect=1)\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [],
        "input": {
          "firstStageSlope": 2,
          "causalSlope": 3,
          "directInstrumentEffect": 1
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "projectionFirstStage=2.000000000, projectionReducedForm=7.000000000, ivRatio=3.500000000, olsSlope=3.400000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "projectionFirstStage": "2.000000000",
          "projectionReducedForm": "7.000000000",
          "ivRatio": "3.500000000",
          "olsSlope": "3.400000000"
        },
        "plotPoints": [
          {
            "x": "-2",
            "y": "-14",
            "series": "Structural path V=U=0"
          },
          {
            "x": "-1",
            "y": "-7",
            "series": "Structural path V=U=0"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Structural path V=U=0"
          },
          {
            "x": "1",
            "y": "7",
            "series": "Structural path V=U=0"
          },
          {
            "x": "2",
            "y": "14",
            "series": "Structural path V=U=0"
          }
        ],
        "plotFile": "econ23-fixed-results/reducedForm-exclusion-r/plot.svg",
        "plotSHA256": "b6a33867a2f56358bcec4fedb94d5abbbf35054bf2b8b08728ebfd48ad6f71f8",
        "files": [
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-r/full-result.Rtext",
            "sha256": "721e17c32856332f39e2383211e00206c2ccc9587c337b7c0e3a6b83e0722af1"
          },
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-r/plot-points.csv",
            "sha256": "f3d0c1255f799ce788a703291f2fca2f283de6af19cedc3b8cd715c9cbb5a602"
          },
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-r/plot.svg",
            "sha256": "b6a33867a2f56358bcec4fedb94d5abbbf35054bf2b8b08728ebfd48ad6f71f8"
          },
          {
            "file": "econ23-fixed-results/reducedForm-exclusion-r/summary.csv",
            "sha256": "ea4dcf85b55d9e5f52aa43ee4b3fb6525c6592f6ade315f77ab4b38d9f0e7e47"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    }
  },
  "selection": {
    "python": {
      "two-groups": {
        "api": "selection",
        "variant": "two-groups",
        "language": "python",
        "codeFile": "econ23-code/selection-two-groups.py",
        "codeSHA256": "8ae9ef66ad4c8f73a7b23d4be25da7329e0ff31207f7255a68e316bd9721b5ce",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='selection'\nINPUT={'rows': [{'id': 'A', 'D': 0, 'y0': 1, 'y1': 3}, {'id': 'B', 'D': 1, 'y0': 4, 'y1': 8}]}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='selection'\nINPUT={'rows': [{'id': 'A', 'D': 0, 'y0': 1, 'y1': 3}, {'id': 'B', 'D': 1, 'y0': 4, 'y1': 8}]}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "A",
              "D": 0,
              "y0": 1,
              "y1": 3
            },
            {
              "id": "B",
              "D": 1,
              "y0": 4,
              "y1": 8
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "ATE=3.000000000, ATT=4.000000000, ATU=2.000000000, observedDifference=7.000000000\n",
        "stderr": "",
        "summary": {
          "ATE": "3.000000000",
          "ATT": "4.000000000",
          "ATU": "2.000000000",
          "observedDifference": "7.000000000"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Stipulated unit effect"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Stipulated unit effect"
          }
        ],
        "plotFile": "econ23-fixed-results/selection-two-groups-python/plot.svg",
        "plotSHA256": "63106397defec71e18257b2798308385e4fbca680c3b8851cd1645baeaf08873",
        "files": [
          {
            "file": "econ23-fixed-results/selection-two-groups-python/full.json",
            "sha256": "293e0e90627775a7b9aed8f87f5f5c1a0f272b32a097bb5932a96755cb44d144"
          },
          {
            "file": "econ23-fixed-results/selection-two-groups-python/plot-points.csv",
            "sha256": "ebabec6cb319606c7f0aad962ed468191534ba95130c9e76ef302b0be671d587"
          },
          {
            "file": "econ23-fixed-results/selection-two-groups-python/plot.svg",
            "sha256": "63106397defec71e18257b2798308385e4fbca680c3b8851cd1645baeaf08873"
          },
          {
            "file": "econ23-fixed-results/selection-two-groups-python/summary.csv",
            "sha256": "9d567094f2f548c8e4fe8eca294c88af185b64f5ab7195b6f0d889de2b5e1793"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "empty-treated": {
        "api": "selection",
        "variant": "empty-treated",
        "language": "python",
        "codeFile": "econ23-code/selection-empty-treated.py",
        "codeSHA256": "b24974486d7f398d3f47260e960a0c5def99c04f42e5cb39cf2f1814221da798",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='selection'\nINPUT={'rows': [{'id': 'A', 'D': 0, 'y0': 1, 'y1': 3}, {'id': 'B', 'D': 0, 'y0': 4, 'y1': 8}]}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='selection'\nINPUT={'rows': [{'id': 'A', 'D': 0, 'y0': 1, 'y1': 3}, {'id': 'B', 'D': 0, 'y0': 4, 'y1': 8}]}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "A",
              "D": 0,
              "y0": 1,
              "y1": 3
            },
            {
              "id": "B",
              "D": 0,
              "y0": 4,
              "y1": 8
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "ATE=3.000000000, ATT=undefined, ATU=3.000000000, observedDifference=undefined\n",
        "stderr": "",
        "summary": {
          "ATE": "3.000000000",
          "ATT": "undefined",
          "ATU": "3.000000000",
          "observedDifference": "undefined"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Stipulated unit effect"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Stipulated unit effect"
          }
        ],
        "plotFile": "econ23-fixed-results/selection-empty-treated-python/plot.svg",
        "plotSHA256": "63106397defec71e18257b2798308385e4fbca680c3b8851cd1645baeaf08873",
        "files": [
          {
            "file": "econ23-fixed-results/selection-empty-treated-python/full.json",
            "sha256": "461780f216666d16bbb25346e9482abb1deaaa2b9c0b72e28c772cdea19d2ddb"
          },
          {
            "file": "econ23-fixed-results/selection-empty-treated-python/plot-points.csv",
            "sha256": "ebabec6cb319606c7f0aad962ed468191534ba95130c9e76ef302b0be671d587"
          },
          {
            "file": "econ23-fixed-results/selection-empty-treated-python/plot.svg",
            "sha256": "63106397defec71e18257b2798308385e4fbca680c3b8851cd1645baeaf08873"
          },
          {
            "file": "econ23-fixed-results/selection-empty-treated-python/summary.csv",
            "sha256": "8475792e17729c09731511ad80f0882d3bed0b074f7768ab373c605ce674e2b1"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    },
    "r": {
      "two-groups": {
        "api": "selection",
        "variant": "two-groups",
        "language": "r",
        "codeFile": "econ23-code/selection-two-groups.R",
        "codeSHA256": "964c25f8a64d76c457151ed083f9fc9541e4e2cb9fdf95ceb8a415bab7c0b281",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"selection\"\r\nINPUT<-list(rows=data.frame(id=c(\"A\",\"B\"),D=c(0,1),y0=c(1,4),y1=c(3,8),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Stipulated unit effect',0,1),pch=ifelse(ss=='Stipulated unit effect',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"selection\"\r\nINPUT<-list(rows=data.frame(id=c(\"A\",\"B\"),D=c(0,1),y0=c(1,4),y1=c(3,8),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Stipulated unit effect',0,1),pch=ifelse(ss=='Stipulated unit effect',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "A",
              "D": 0,
              "y0": 1,
              "y1": 3
            },
            {
              "id": "B",
              "D": 1,
              "y0": 4,
              "y1": 8
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "ATE=3.000000000, ATT=4.000000000, ATU=2.000000000, observedDifference=7.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "ATE": "3.000000000",
          "ATT": "4.000000000",
          "ATU": "2.000000000",
          "observedDifference": "7.000000000"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Stipulated unit effect"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Stipulated unit effect"
          }
        ],
        "plotFile": "econ23-peer-display-corrected/selection-two-groups-r/plot.svg",
        "plotSHA256": "0e574c141aa728dfb8b015877759ffed5a9d76814a11b546ea321aadfb428432",
        "files": [
          {
            "file": "econ23-peer-display-corrected/selection-two-groups-r/full-result.Rtext",
            "sha256": "d66974385190affeadde838579be473a91e9b47f9200165ab3b3b2228a145cc0"
          },
          {
            "file": "econ23-peer-display-corrected/selection-two-groups-r/plot-points.csv",
            "sha256": "115b453344a707ca6a5a4cd0f77b45015438e57f1de532a5f7de20468d2d591e"
          },
          {
            "file": "econ23-peer-display-corrected/selection-two-groups-r/plot.svg",
            "sha256": "0e574c141aa728dfb8b015877759ffed5a9d76814a11b546ea321aadfb428432"
          },
          {
            "file": "econ23-peer-display-corrected/selection-two-groups-r/summary.csv",
            "sha256": "c23ba6bf50d556350cc2d560c7a0c192b1dc2e96f310017b31d265295349ed29"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "empty-treated": {
        "api": "selection",
        "variant": "empty-treated",
        "language": "r",
        "codeFile": "econ23-code/selection-empty-treated.R",
        "codeSHA256": "ee6ef7810604f5a7c9d99529f7f34201196d807dcbcf9b3f19943f4817b167fb",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"selection\"\r\nINPUT<-list(rows=data.frame(id=c(\"A\",\"B\"),D=c(0,0),y0=c(1,4),y1=c(3,8),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Stipulated unit effect',0,1),pch=ifelse(ss=='Stipulated unit effect',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"selection\"\r\nINPUT<-list(rows=data.frame(id=c(\"A\",\"B\"),D=c(0,0),y0=c(1,4),y1=c(3,8),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Stipulated unit effect',0,1),pch=ifelse(ss=='Stipulated unit effect',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "A",
              "D": 0,
              "y0": 1,
              "y1": 3
            },
            {
              "id": "B",
              "D": 0,
              "y0": 4,
              "y1": 8
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "ATE=3.000000000, ATT=undefined, ATU=3.000000000, observedDifference=undefined \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "ATE": "3.000000000",
          "ATT": "undefined",
          "ATU": "3.000000000",
          "observedDifference": "undefined"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Stipulated unit effect"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Stipulated unit effect"
          }
        ],
        "plotFile": "econ23-peer-display-corrected/selection-empty-treated-r/plot.svg",
        "plotSHA256": "0e574c141aa728dfb8b015877759ffed5a9d76814a11b546ea321aadfb428432",
        "files": [
          {
            "file": "econ23-peer-display-corrected/selection-empty-treated-r/full-result.Rtext",
            "sha256": "8982fe954f0067900462aa2c1015bec246caf5f7858ab60ad20bcad2668286c0"
          },
          {
            "file": "econ23-peer-display-corrected/selection-empty-treated-r/plot-points.csv",
            "sha256": "115b453344a707ca6a5a4cd0f77b45015438e57f1de532a5f7de20468d2d591e"
          },
          {
            "file": "econ23-peer-display-corrected/selection-empty-treated-r/plot.svg",
            "sha256": "0e574c141aa728dfb8b015877759ffed5a9d76814a11b546ea321aadfb428432"
          },
          {
            "file": "econ23-peer-display-corrected/selection-empty-treated-r/summary.csv",
            "sha256": "4a7afa980d49dac49e79cfe375eed26c7ef38caef8cc323f88c50fde54821875"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    }
  },
  "iv": {
    "python": {
      "four-units": {
        "api": "iv",
        "variant": "four-units",
        "language": "python",
        "codeFile": "econ23-code/iv-four-units.py",
        "codeSHA256": "604ca315d1a417aab23e29f581764a6f68a895460f2e7d20e1d662cb52b2006a",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\r\n\r\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\r\n\r\nRereads native-field CSVs, not a stored model or expected result. All sample\r\ncovariances use the common complete, positive-weight frame and divide by its\r\nweight sum. They are arithmetic moments, not unbiased variance estimates.\r\nThe program implements declared arithmetic, not causal-identification testing,\r\nrobust standard errors, weak-IV inference or a published controlled replication.\r\nMissing observed fields remain missing. Required/optional numeric None is never\r\nsilently changed to a default. Production parser/budget limits are separate.\r\n\"\"\"\r\nfrom pathlib import Path\r\nfrom fractions import Fraction as F\r\nimport argparse,csv,json,math\r\n\r\ndef q(value):\r\n if value is None:raise ValueError('explicit null is not a numeric parameter')\r\n return F(value)\r\ndef parse_rows(records,fields):\r\n if not records:raise ValueError('rows required')\r\n ids=set();out=[]\r\n for i,record in enumerate(records):\r\n  rid=str(record.get('id',i))\r\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\r\n  ids.add(rid);w=q(record.get('weight',1))\r\n  if w<0:raise ValueError('negative weight')\r\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\r\n return out\r\ndef mass(rows):return sum((r['weight'] for r in rows),F())\r\ndef mean(rows,key):\r\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\r\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\r\ndef equilibrium(a):\r\n b=q(a['demandSlope']);d=q(a['supplySlope'])\r\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\r\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\r\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\r\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\r\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\r\ndef reduced_form(a):\r\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\r\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\r\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\r\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\r\ndef selection(a):\r\n rr=parse_rows(a['rows'],['y0','y1'])\r\n for r,original in zip(rr,a['rows']):\r\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\r\n  D=int(original['D'])\r\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\r\n  r.update(D=D,effect=r['y1']-r['y0'])\r\n good=[r for r in rr if r['weight']>0];W=mass(good)\r\n if not W:raise ValueError('positive total weight required')\r\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\r\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\r\ndef iv(a):\r\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\r\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\r\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\r\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\r\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\r\ndef did(a):\r\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\r\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\r\n drift=q(a.get('assumedUntreatedTrendDifference',0))\r\n for r,o in zip(data,a['rows']):\r\n  group=int(o['group'])\r\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\r\n  r['group']=group\r\n good=[r for r in data if r['weight']>0];groups=[]\r\n for group in [0,1]:\r\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\r\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\r\ndef readcsv(file):\r\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\r\ndef read_sources(source):\r\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\r\n for year in range(1980,2025):\r\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\r\n person=[]\r\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\r\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\r\n company=[]\r\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\r\n  def fte(suffix):\r\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\r\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\r\n return dict(country=country,person=person,company=company)\r\n_OMITTED_OPTIONS=object()\r\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\r\n options={} if options is _OMITTED_OPTIONS else options\r\n if not isinstance(options,dict):raise ValueError('options object required')\r\n if kind=='country':\r\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\r\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\r\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\r\n if kind=='person':return iv(dict(rows=models[kind]))\r\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\r\n raise ValueError('known actual case required')\r\ndef serial(x):\r\n if isinstance(x,F):return str(x)\r\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\r\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\r\n return x\r\ndef writecsv(file,heads,rows):\r\n with Path(file).open('w',encoding='utf8',newline='') as f:\r\n  w=csv.writer(f);w.writerow(heads)\r\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\r\nAPI='iv'\r\nINPUT={'rows': [{'id': 'a', 'y': 2, 'x': 1, 'z': 0}, {'id': 'b', 'y': 4, 'x': 2, 'z': 0}, {'id': 'c', 'y': 8, 'x': 3, 'z': 1}, {'id': 'd', 'y': 10, 'x': 4, 'z': 1}]}\r\n\r\ndef run_fixed(api,a,output,source):\r\n import matplotlib\r\n matplotlib.use('svg')\r\n import matplotlib.pyplot as plt\r\n from matplotlib.ticker import MaxNLocator\r\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\r\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\r\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\r\n def add(x,y,s):\r\n  if y is not None:points.append([x,y,s])\r\n if api=='equilibrium':\r\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\r\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\r\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\r\n elif api=='reducedForm':\r\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\r\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\r\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\r\n elif api=='selection':\r\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\r\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\r\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\r\n elif api in ['iv','realdata'] and a.get('kind')!='company':\r\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\r\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\r\n  if good:\r\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\r\n    b=result[key]\r\n    if b is not None:\r\n     alpha=result['means']['y']-b*result['means']['x']\r\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\r\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\r\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\r\n else:\r\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\r\n  for g in result['groups']:\r\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\r\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\r\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\r\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\r\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\r\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\r\n colors=['#355c72','#a55336','#507956']\r\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\r\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\r\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\r\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\r\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,.98),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\r\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\r\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\r\nif __name__=='__main__':\r\n import sys\r\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\r\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\r\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\r\n\r\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\r\n\r\nRereads native-field CSVs, not a stored model or expected result. All sample\r\ncovariances use the common complete, positive-weight frame and divide by its\r\nweight sum. They are arithmetic moments, not unbiased variance estimates.\r\nThe program implements declared arithmetic, not causal-identification testing,\r\nrobust standard errors, weak-IV inference or a published controlled replication.\r\nMissing observed fields remain missing. Required/optional numeric None is never\r\nsilently changed to a default. Production parser/budget limits are separate.\r\n\"\"\"\r\nfrom pathlib import Path\r\nfrom fractions import Fraction as F\r\nimport argparse,csv,json,math\r\n\r\ndef q(value):\r\n if value is None:raise ValueError('explicit null is not a numeric parameter')\r\n return F(value)\r\ndef parse_rows(records,fields):\r\n if not records:raise ValueError('rows required')\r\n ids=set();out=[]\r\n for i,record in enumerate(records):\r\n  rid=str(record.get('id',i))\r\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\r\n  ids.add(rid);w=q(record.get('weight',1))\r\n  if w<0:raise ValueError('negative weight')\r\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\r\n return out\r\ndef mass(rows):return sum((r['weight'] for r in rows),F())\r\ndef mean(rows,key):\r\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\r\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\r\ndef equilibrium(a):\r\n b=q(a['demandSlope']);d=q(a['supplySlope'])\r\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\r\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\r\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\r\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\r\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\r\ndef reduced_form(a):\r\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\r\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\r\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\r\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\r\ndef selection(a):\r\n rr=parse_rows(a['rows'],['y0','y1'])\r\n for r,original in zip(rr,a['rows']):\r\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\r\n  D=int(original['D'])\r\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\r\n  r.update(D=D,effect=r['y1']-r['y0'])\r\n good=[r for r in rr if r['weight']>0];W=mass(good)\r\n if not W:raise ValueError('positive total weight required')\r\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\r\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\r\ndef iv(a):\r\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\r\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\r\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\r\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\r\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\r\ndef did(a):\r\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\r\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\r\n drift=q(a.get('assumedUntreatedTrendDifference',0))\r\n for r,o in zip(data,a['rows']):\r\n  group=int(o['group'])\r\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\r\n  r['group']=group\r\n good=[r for r in data if r['weight']>0];groups=[]\r\n for group in [0,1]:\r\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\r\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\r\ndef readcsv(file):\r\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\r\ndef read_sources(source):\r\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\r\n for year in range(1980,2025):\r\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\r\n person=[]\r\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\r\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\r\n company=[]\r\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\r\n  def fte(suffix):\r\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\r\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\r\n return dict(country=country,person=person,company=company)\r\n_OMITTED_OPTIONS=object()\r\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\r\n options={} if options is _OMITTED_OPTIONS else options\r\n if not isinstance(options,dict):raise ValueError('options object required')\r\n if kind=='country':\r\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\r\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\r\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\r\n if kind=='person':return iv(dict(rows=models[kind]))\r\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\r\n raise ValueError('known actual case required')\r\ndef serial(x):\r\n if isinstance(x,F):return str(x)\r\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\r\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\r\n return x\r\ndef writecsv(file,heads,rows):\r\n with Path(file).open('w',encoding='utf8',newline='') as f:\r\n  w=csv.writer(f);w.writerow(heads)\r\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\r\nAPI='iv'\r\nINPUT={'rows': [{'id': 'a', 'y': 2, 'x': 1, 'z': 0}, {'id': 'b', 'y': 4, 'x': 2, 'z': 0}, {'id': 'c', 'y': 8, 'x': 3, 'z': 1}, {'id': 'd', 'y': 10, 'x': 4, 'z': 1}]}\r\n\r\ndef run_fixed(api,a,output,source):\r\n import matplotlib\r\n matplotlib.use('svg')\r\n import matplotlib.pyplot as plt\r\n from matplotlib.ticker import MaxNLocator\r\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\r\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\r\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\r\n def add(x,y,s):\r\n  if y is not None:points.append([x,y,s])\r\n if api=='equilibrium':\r\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\r\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\r\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\r\n elif api=='reducedForm':\r\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\r\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\r\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\r\n elif api=='selection':\r\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\r\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\r\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\r\n elif api in ['iv','realdata'] and a.get('kind')!='company':\r\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\r\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\r\n  if good:\r\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\r\n    b=result[key]\r\n    if b is not None:\r\n     alpha=result['means']['y']-b*result['means']['x']\r\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\r\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\r\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\r\n else:\r\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\r\n  for g in result['groups']:\r\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\r\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\r\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\r\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\r\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\r\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\r\n colors=['#355c72','#a55336','#507956']\r\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\r\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\r\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\r\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\r\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,.98),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\r\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\r\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\r\nif __name__=='__main__':\r\n import sys\r\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\r\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\r\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "a",
              "y": 2,
              "x": 1,
              "z": 0
            },
            {
              "id": "b",
              "y": 4,
              "x": 2,
              "z": 0
            },
            {
              "id": "c",
              "y": 8,
              "x": 3,
              "z": 1
            },
            {
              "id": "d",
              "y": 10,
              "x": 4,
              "z": 1
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=4.000000000, firstStageProjection=2.000000000, ivRatio=3.000000000, olsProjection=2.800000000\n",
        "stderr": "",
        "summary": {
          "completePositiveWeightUnits": "4.000000000",
          "firstStageProjection": "2.000000000",
          "ivRatio": "3.000000000",
          "olsProjection": "2.800000000"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "8",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "10",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "9/5",
            "series": "OLS projection"
          },
          {
            "x": "4",
            "y": "51/5",
            "series": "OLS projection"
          },
          {
            "x": "1",
            "y": "3/2",
            "series": "IV moment line"
          },
          {
            "x": "4",
            "y": "21/2",
            "series": "IV moment line"
          }
        ],
        "plotFile": "econ23-fixed-results/iv-four-units-python/plot.svg",
        "plotSHA256": "f3f6197f3d30d161725460b955703326bbc29e2621ca7a284bf27acd903fb317",
        "files": [
          {
            "file": "econ23-fixed-results/iv-four-units-python/full.json",
            "sha256": "c6e74e0bc598a1e8c183054bc5126aa216d9609e89a331f6c16c90c6de690f6e"
          },
          {
            "file": "econ23-fixed-results/iv-four-units-python/plot-points.csv",
            "sha256": "0ce70b54380fa2f45cd10eea4a40a5e2663319bc60896306993e94134160984a"
          },
          {
            "file": "econ23-fixed-results/iv-four-units-python/plot.svg",
            "sha256": "f3f6197f3d30d161725460b955703326bbc29e2621ca7a284bf27acd903fb317"
          },
          {
            "file": "econ23-fixed-results/iv-four-units-python/summary.csv",
            "sha256": "dc2f4068d175ac60d859a0d663a7ac9b59b274dfab9d34d16c2eec4c185e588c"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "constant-Z": {
        "api": "iv",
        "variant": "constant-Z",
        "language": "python",
        "codeFile": "econ23-code/iv-constant-Z.py",
        "codeSHA256": "66aba9f0cea755aa3ef7fad0de84c8d6af8b2be9d1edf3ce8f3d7ee31f3e3bfd",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='iv'\nINPUT={'rows': [{'id': 'a', 'y': 2, 'x': 1, 'z': 0}, {'id': 'b', 'y': 4, 'x': 2, 'z': 0}, {'id': 'c', 'y': 8, 'x': 3, 'z': 0}, {'id': 'd', 'y': 10, 'x': 4, 'z': 0}]}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='iv'\nINPUT={'rows': [{'id': 'a', 'y': 2, 'x': 1, 'z': 0}, {'id': 'b', 'y': 4, 'x': 2, 'z': 0}, {'id': 'c', 'y': 8, 'x': 3, 'z': 0}, {'id': 'd', 'y': 10, 'x': 4, 'z': 0}]}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "a",
              "y": 2,
              "x": 1,
              "z": 0
            },
            {
              "id": "b",
              "y": 4,
              "x": 2,
              "z": 0
            },
            {
              "id": "c",
              "y": 8,
              "x": 3,
              "z": 0
            },
            {
              "id": "d",
              "y": 10,
              "x": 4,
              "z": 0
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=4.000000000, firstStageProjection=undefined, ivRatio=undefined, olsProjection=2.800000000\n",
        "stderr": "",
        "summary": {
          "completePositiveWeightUnits": "4.000000000",
          "firstStageProjection": "undefined",
          "ivRatio": "undefined",
          "olsProjection": "2.800000000"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "8",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "10",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "9/5",
            "series": "OLS projection"
          },
          {
            "x": "4",
            "y": "51/5",
            "series": "OLS projection"
          }
        ],
        "plotFile": "econ23-fixed-results/iv-constant-Z-python/plot.svg",
        "plotSHA256": "0f28b419b03c33b9189af25eb994e902f39469f60763114921cf9d15a43cfedc",
        "files": [
          {
            "file": "econ23-fixed-results/iv-constant-Z-python/full.json",
            "sha256": "bc5ec18faebb212aaa21903156a4088458e9539e65357154d442a47fe44797fd"
          },
          {
            "file": "econ23-fixed-results/iv-constant-Z-python/plot-points.csv",
            "sha256": "5aaa839a2127aa3765d93960f4e6dd075fc73044cbf5d3a5824f91c72e6d8790"
          },
          {
            "file": "econ23-fixed-results/iv-constant-Z-python/plot.svg",
            "sha256": "0f28b419b03c33b9189af25eb994e902f39469f60763114921cf9d15a43cfedc"
          },
          {
            "file": "econ23-fixed-results/iv-constant-Z-python/summary.csv",
            "sha256": "c92d3a9e0b7a372342dfa413517bc4ea85a2116f7ab28ce703225dfdc5478d4e"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    },
    "r": {
      "four-units": {
        "api": "iv",
        "variant": "four-units",
        "language": "r",
        "codeFile": "econ23-code/iv-four-units.R",
        "codeSHA256": "daabfa1a57431d764e2248931c24e3f91d0ddc5927e3bb5341a5ec010522b65d",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"iv\"\r\nINPUT<-list(rows=data.frame(id=c(\"a\",\"b\",\"c\",\"d\"),y=c(2,4,8,10),x=c(1,2,3,4),z=c(0,0,1,1),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"iv\"\r\nINPUT<-list(rows=data.frame(id=c(\"a\",\"b\",\"c\",\"d\"),y=c(2,4,8,10),x=c(1,2,3,4),z=c(0,0,1,1),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "a",
              "y": 2,
              "x": 1,
              "z": 0
            },
            {
              "id": "b",
              "y": 4,
              "x": 2,
              "z": 0
            },
            {
              "id": "c",
              "y": 8,
              "x": 3,
              "z": 1
            },
            {
              "id": "d",
              "y": 10,
              "x": 4,
              "z": 1
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=4.000000000, firstStageProjection=2.000000000, ivRatio=3.000000000, olsProjection=2.800000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "completePositiveWeightUnits": "4.000000000",
          "firstStageProjection": "2.000000000",
          "ivRatio": "3.000000000",
          "olsProjection": "2.800000000"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "8",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "10",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "1.8",
            "series": "OLS projection"
          },
          {
            "x": "4",
            "y": "10.2",
            "series": "OLS projection"
          },
          {
            "x": "1",
            "y": "1.5",
            "series": "IV moment line"
          },
          {
            "x": "4",
            "y": "10.5",
            "series": "IV moment line"
          }
        ],
        "plotFile": "econ23-peer-display-corrected/iv-four-units-r/plot.svg",
        "plotSHA256": "3e8380a71955186b2180cfd9c04df5c3e47b11ad84e05dfebee994b66678e3bb",
        "files": [
          {
            "file": "econ23-peer-display-corrected/iv-four-units-r/full-result.Rtext",
            "sha256": "bdffedb607d90058241c6518f16677205db24272e69bcce9c5866a82e1c20b74"
          },
          {
            "file": "econ23-peer-display-corrected/iv-four-units-r/plot-points.csv",
            "sha256": "506c4d2519ac2d4889cc9fe5abfc109d1e07a7f9f89003e76dab95f58e5d71cb"
          },
          {
            "file": "econ23-peer-display-corrected/iv-four-units-r/plot.svg",
            "sha256": "3e8380a71955186b2180cfd9c04df5c3e47b11ad84e05dfebee994b66678e3bb"
          },
          {
            "file": "econ23-peer-display-corrected/iv-four-units-r/summary.csv",
            "sha256": "2e8f15a20d6e9878a668df8153cd9e252b05319de3fe4c50af73518ecd6d9f51"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "constant-Z": {
        "api": "iv",
        "variant": "constant-Z",
        "language": "r",
        "codeFile": "econ23-code/iv-constant-Z.R",
        "codeSHA256": "53bb369b303739991591c5de97faed80f096443fc0addd1443bdbad232783cd3",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"iv\"\r\nINPUT<-list(rows=data.frame(id=c(\"a\",\"b\",\"c\",\"d\"),y=c(2,4,8,10),x=c(1,2,3,4),z=c(0,0,0,0),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"iv\"\r\nINPUT<-list(rows=data.frame(id=c(\"a\",\"b\",\"c\",\"d\"),y=c(2,4,8,10),x=c(1,2,3,4),z=c(0,0,0,0),stringsAsFactors=FALSE))\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "a",
              "y": 2,
              "x": 1,
              "z": 0
            },
            {
              "id": "b",
              "y": 4,
              "x": 2,
              "z": 0
            },
            {
              "id": "c",
              "y": 8,
              "x": 3,
              "z": 0
            },
            {
              "id": "d",
              "y": 10,
              "x": 4,
              "z": 0
            }
          ]
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=4.000000000, firstStageProjection=undefined, ivRatio=undefined, olsProjection=2.800000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "completePositiveWeightUnits": "4.000000000",
          "firstStageProjection": "undefined",
          "ivRatio": "undefined",
          "olsProjection": "2.800000000"
        },
        "plotPoints": [
          {
            "x": "1",
            "y": "2",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "8",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "10",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "1.8",
            "series": "OLS projection"
          },
          {
            "x": "4",
            "y": "10.2",
            "series": "OLS projection"
          }
        ],
        "plotFile": "econ23-peer-display-corrected/iv-constant-Z-r/plot.svg",
        "plotSHA256": "a35891c00d60ec09e61b6744e7533e38cf8efab871d6ea7b79907a3cf103b80c",
        "files": [
          {
            "file": "econ23-peer-display-corrected/iv-constant-Z-r/full-result.Rtext",
            "sha256": "3ef5c6d62e151ab34353ff0c70ba45ef2ce2959a8e21b75de410cf6a36387206"
          },
          {
            "file": "econ23-peer-display-corrected/iv-constant-Z-r/plot-points.csv",
            "sha256": "aa5256a6f6d00bca7b4005d3c1a54fab4879f90fa5b3c0be8948f1414486b617"
          },
          {
            "file": "econ23-peer-display-corrected/iv-constant-Z-r/plot.svg",
            "sha256": "a35891c00d60ec09e61b6744e7533e38cf8efab871d6ea7b79907a3cf103b80c"
          },
          {
            "file": "econ23-peer-display-corrected/iv-constant-Z-r/summary.csv",
            "sha256": "f5046d79d79663a2c378d8805be5c80f3da4370f688428f2d1c46b1d5b0050e1"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    }
  },
  "did": {
    "python": {
      "paired": {
        "api": "did",
        "variant": "paired",
        "language": "python",
        "codeFile": "econ23-code/did-paired.py",
        "codeSHA256": "5313e0f36f0955fea4c74e17bcdb0eb29f6f1b8f64237738728673104967266e",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='did'\nINPUT={'rows': [{'id': 'c1', 'group': 0, 'before': 10, 'after': 12}, {'id': 'c2', 'group': 0, 'before': 20, 'after': None}, {'id': 't1', 'group': 1, 'before': 10, 'after': 13}, {'id': 't2', 'group': 1, 'before': 20, 'after': 23}], 'frame': 'paired'}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='did'\nINPUT={'rows': [{'id': 'c1', 'group': 0, 'before': 10, 'after': 12}, {'id': 'c2', 'group': 0, 'before': 20, 'after': None}, {'id': 't1', 'group': 1, 'before': 10, 'after': 13}, {'id': 't2', 'group': 1, 'before': 20, 'after': 23}], 'frame': 'paired'}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "c1",
              "group": 0,
              "before": 10,
              "after": 12
            },
            {
              "id": "c2",
              "group": 0,
              "before": 20,
              "after": null
            },
            {
              "id": "t1",
              "group": 1,
              "before": 10,
              "after": 13
            },
            {
              "id": "t2",
              "group": 1,
              "before": 20,
              "after": 23
            }
          ],
          "frame": "paired"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=1.000000000, sensitivityAdjustedContrast=1.000000000, group0-commonUnits=1.000000000, group1-commonUnits=2.000000000\n",
        "stderr": "",
        "summary": {
          "differenceInDifferences": "1.000000000",
          "sensitivityAdjustedContrast": "1.000000000",
          "group0-commonUnits": "1.000000000",
          "group1-commonUnits": "2.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "10",
            "series": "Group 0"
          },
          {
            "x": "1",
            "y": "12",
            "series": "Group 0"
          },
          {
            "x": "0",
            "y": "15",
            "series": "Group 1"
          },
          {
            "x": "1",
            "y": "18",
            "series": "Group 1"
          }
        ],
        "plotFile": "econ23-fixed-results/did-paired-python/plot.svg",
        "plotSHA256": "4ba716dff5183872ec3f67a3e0b6f99e79e121aaaba43fbdc655409a87642f15",
        "files": [
          {
            "file": "econ23-fixed-results/did-paired-python/full.json",
            "sha256": "fadccc86490390df6d752d9a26f08d1acdaf3bed2f358294002694e330a2a959"
          },
          {
            "file": "econ23-fixed-results/did-paired-python/plot-points.csv",
            "sha256": "c568c090b3baa08a41265766f06f0466c9d849667ce102326ccdc54a404f96a6"
          },
          {
            "file": "econ23-fixed-results/did-paired-python/plot.svg",
            "sha256": "4ba716dff5183872ec3f67a3e0b6f99e79e121aaaba43fbdc655409a87642f15"
          },
          {
            "file": "econ23-fixed-results/did-paired-python/summary.csv",
            "sha256": "bf3e37dca3402af2ae014a4e305f8513cba29ff1dfcd2c27af04d8e855f353c8"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "available": {
        "api": "did",
        "variant": "available",
        "language": "python",
        "codeFile": "econ23-code/did-available.py",
        "codeSHA256": "4f4ce4f267e9aac77d633bb8a203fc04310f6013ba3bdf8fa2ea8c73e2b2a0ac",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='did'\nINPUT={'rows': [{'id': 'c1', 'group': 0, 'before': 10, 'after': 12}, {'id': 'c2', 'group': 0, 'before': 20, 'after': None}, {'id': 't1', 'group': 1, 'before': 10, 'after': 13}, {'id': 't2', 'group': 1, 'before': 20, 'after': 23}], 'frame': 'available'}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='did'\nINPUT={'rows': [{'id': 'c1', 'group': 0, 'before': 10, 'after': 12}, {'id': 'c2', 'group': 0, 'before': 20, 'after': None}, {'id': 't1', 'group': 1, 'before': 10, 'after': 13}, {'id': 't2', 'group': 1, 'before': 20, 'after': 23}], 'frame': 'available'}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "c1",
              "group": 0,
              "before": 10,
              "after": 12
            },
            {
              "id": "c2",
              "group": 0,
              "before": 20,
              "after": null
            },
            {
              "id": "t1",
              "group": 1,
              "before": 10,
              "after": 13
            },
            {
              "id": "t2",
              "group": 1,
              "before": 20,
              "after": 23
            }
          ],
          "frame": "available"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=6.000000000, sensitivityAdjustedContrast=6.000000000, group0-commonUnits=1.000000000, group1-commonUnits=2.000000000\n",
        "stderr": "",
        "summary": {
          "differenceInDifferences": "6.000000000",
          "sensitivityAdjustedContrast": "6.000000000",
          "group0-commonUnits": "1.000000000",
          "group1-commonUnits": "2.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "15",
            "series": "Group 0"
          },
          {
            "x": "1",
            "y": "12",
            "series": "Group 0"
          },
          {
            "x": "0",
            "y": "15",
            "series": "Group 1"
          },
          {
            "x": "1",
            "y": "18",
            "series": "Group 1"
          }
        ],
        "plotFile": "econ23-fixed-results/did-available-python/plot.svg",
        "plotSHA256": "a734e63edb2cced800cd049d847b9fc34a56b077fc99a07c2b49bfc450ed7608",
        "files": [
          {
            "file": "econ23-fixed-results/did-available-python/full.json",
            "sha256": "1f08234b5adce53f2f5ec002cc607f3f36cf4c2b53f7ff585fdf11acc1274052"
          },
          {
            "file": "econ23-fixed-results/did-available-python/plot-points.csv",
            "sha256": "05958bf8de13b6150be674fbcd0f1c3927871b7c7d7992935147c5bda157129e"
          },
          {
            "file": "econ23-fixed-results/did-available-python/plot.svg",
            "sha256": "a734e63edb2cced800cd049d847b9fc34a56b077fc99a07c2b49bfc450ed7608"
          },
          {
            "file": "econ23-fixed-results/did-available-python/summary.csv",
            "sha256": "ebe36e37b341ab236dfe71bbad3636c81208e1c2dde8fb03209a0e0107bf2e73"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    },
    "r": {
      "paired": {
        "api": "did",
        "variant": "paired",
        "language": "r",
        "codeFile": "econ23-code/did-paired.R",
        "codeSHA256": "6ba9c219e3838b8625db6ecb4c68d6b6486d2dd1b924d0708ebdd3862a249c2c",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"did\"\nINPUT<-list(rows=data.frame(id=c(\"c1\",\"c2\",\"t1\",\"t2\"),group=c(0,0,1,1),before=c(10,20,10,20),after=c(12,NA_real_,13,23),stringsAsFactors=FALSE),frame=\"paired\")\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"did\"\nINPUT<-list(rows=data.frame(id=c(\"c1\",\"c2\",\"t1\",\"t2\"),group=c(0,0,1,1),before=c(10,20,10,20),after=c(12,NA_real_,13,23),stringsAsFactors=FALSE),frame=\"paired\")\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "c1",
              "group": 0,
              "before": 10,
              "after": 12
            },
            {
              "id": "c2",
              "group": 0,
              "before": 20,
              "after": null
            },
            {
              "id": "t1",
              "group": 1,
              "before": 10,
              "after": 13
            },
            {
              "id": "t2",
              "group": 1,
              "before": 20,
              "after": 23
            }
          ],
          "frame": "paired"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=1.000000000, sensitivityAdjustedContrast=1.000000000, group0-commonUnits=1.000000000, group1-commonUnits=2.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "differenceInDifferences": "1.000000000",
          "sensitivityAdjustedContrast": "1.000000000",
          "group0-commonUnits": "1.000000000",
          "group1-commonUnits": "2.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "10",
            "series": "Group 0"
          },
          {
            "x": "1",
            "y": "12",
            "series": "Group 0"
          },
          {
            "x": "0",
            "y": "15",
            "series": "Group 1"
          },
          {
            "x": "1",
            "y": "18",
            "series": "Group 1"
          }
        ],
        "plotFile": "econ23-fixed-results/did-paired-r/plot.svg",
        "plotSHA256": "df3c9b3568877a6feb15b4b729db3a1eb93b2a01f07a7a80fe27ed5e3a3904aa",
        "files": [
          {
            "file": "econ23-fixed-results/did-paired-r/full-result.Rtext",
            "sha256": "9b848d9e00c8a6651cc145bad3aa334891761d8dc9e6e3b255090b564f2b1c5a"
          },
          {
            "file": "econ23-fixed-results/did-paired-r/plot-points.csv",
            "sha256": "a404d87cdeecd4baad070c792616043889a351068481e98894dd2e817e496257"
          },
          {
            "file": "econ23-fixed-results/did-paired-r/plot.svg",
            "sha256": "df3c9b3568877a6feb15b4b729db3a1eb93b2a01f07a7a80fe27ed5e3a3904aa"
          },
          {
            "file": "econ23-fixed-results/did-paired-r/summary.csv",
            "sha256": "21a5279c0c50d0eed3182f15b5a7b8fa401b7c2de9cff5c20a09f3acb6234279"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "available": {
        "api": "did",
        "variant": "available",
        "language": "r",
        "codeFile": "econ23-code/did-available.R",
        "codeSHA256": "ac141c3a7cd48d638b9ac1be2a64528343cb7a431706ea3d5a1a0130e65d445a",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"did\"\nINPUT<-list(rows=data.frame(id=c(\"c1\",\"c2\",\"t1\",\"t2\"),group=c(0,0,1,1),before=c(10,20,10,20),after=c(12,NA_real_,13,23),stringsAsFactors=FALSE),frame=\"available\")\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"did\"\nINPUT<-list(rows=data.frame(id=c(\"c1\",\"c2\",\"t1\",\"t2\"),group=c(0,0,1,1),before=c(10,20,10,20),after=c(12,NA_real_,13,23),stringsAsFactors=FALSE),frame=\"available\")\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [],
        "input": {
          "rows": [
            {
              "id": "c1",
              "group": 0,
              "before": 10,
              "after": 12
            },
            {
              "id": "c2",
              "group": 0,
              "before": 20,
              "after": null
            },
            {
              "id": "t1",
              "group": 1,
              "before": 10,
              "after": 13
            },
            {
              "id": "t2",
              "group": 1,
              "before": 20,
              "after": 23
            }
          ],
          "frame": "available"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=6.000000000, sensitivityAdjustedContrast=6.000000000, group0-commonUnits=1.000000000, group1-commonUnits=2.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "differenceInDifferences": "6.000000000",
          "sensitivityAdjustedContrast": "6.000000000",
          "group0-commonUnits": "1.000000000",
          "group1-commonUnits": "2.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "15",
            "series": "Group 0"
          },
          {
            "x": "1",
            "y": "12",
            "series": "Group 0"
          },
          {
            "x": "0",
            "y": "15",
            "series": "Group 1"
          },
          {
            "x": "1",
            "y": "18",
            "series": "Group 1"
          }
        ],
        "plotFile": "econ23-fixed-results/did-available-r/plot.svg",
        "plotSHA256": "200d9606b384b659baf4d931575a644addd058b2b136d8699c45afebcc334a18",
        "files": [
          {
            "file": "econ23-fixed-results/did-available-r/full-result.Rtext",
            "sha256": "0835aed090b1a98923738a2700449bf012c629141618978ae262cd16efa142a6"
          },
          {
            "file": "econ23-fixed-results/did-available-r/plot-points.csv",
            "sha256": "7361e49bdc89d6014e7b7a3b413eb66d994b8a29a12c68f8a84155855b53b5d8"
          },
          {
            "file": "econ23-fixed-results/did-available-r/plot.svg",
            "sha256": "200d9606b384b659baf4d931575a644addd058b2b136d8699c45afebcc334a18"
          },
          {
            "file": "econ23-fixed-results/did-available-r/summary.csv",
            "sha256": "51266748110b70f1f3dd38828f168b9b07ca25c880f46cfc5088ec4ca83891b9"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    }
  },
  "realdata": {
    "python": {
      "country": {
        "api": "realdata",
        "variant": "country",
        "language": "python",
        "codeFile": "econ23-code/realdata-country.py",
        "codeSHA256": "86c836a95cf65c0e956b3538d720637b05c7a73564cfd39a282e7a9bf64dee42",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\r\n\r\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\r\n\r\nRereads native-field CSVs, not a stored model or expected result. All sample\r\ncovariances use the common complete, positive-weight frame and divide by its\r\nweight sum. They are arithmetic moments, not unbiased variance estimates.\r\nThe program implements declared arithmetic, not causal-identification testing,\r\nrobust standard errors, weak-IV inference or a published controlled replication.\r\nMissing observed fields remain missing. Required/optional numeric None is never\r\nsilently changed to a default. Production parser/budget limits are separate.\r\n\"\"\"\r\nfrom pathlib import Path\r\nfrom fractions import Fraction as F\r\nimport argparse,csv,json,math\r\n\r\ndef q(value):\r\n if value is None:raise ValueError('explicit null is not a numeric parameter')\r\n return F(value)\r\ndef parse_rows(records,fields):\r\n if not records:raise ValueError('rows required')\r\n ids=set();out=[]\r\n for i,record in enumerate(records):\r\n  rid=str(record.get('id',i))\r\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\r\n  ids.add(rid);w=q(record.get('weight',1))\r\n  if w<0:raise ValueError('negative weight')\r\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\r\n return out\r\ndef mass(rows):return sum((r['weight'] for r in rows),F())\r\ndef mean(rows,key):\r\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\r\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\r\ndef equilibrium(a):\r\n b=q(a['demandSlope']);d=q(a['supplySlope'])\r\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\r\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\r\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\r\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\r\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\r\ndef reduced_form(a):\r\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\r\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\r\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\r\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\r\ndef selection(a):\r\n rr=parse_rows(a['rows'],['y0','y1'])\r\n for r,original in zip(rr,a['rows']):\r\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\r\n  D=int(original['D'])\r\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\r\n  r.update(D=D,effect=r['y1']-r['y0'])\r\n good=[r for r in rr if r['weight']>0];W=mass(good)\r\n if not W:raise ValueError('positive total weight required')\r\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\r\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\r\ndef iv(a):\r\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\r\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\r\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\r\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\r\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\r\ndef did(a):\r\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\r\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\r\n drift=q(a.get('assumedUntreatedTrendDifference',0))\r\n for r,o in zip(data,a['rows']):\r\n  group=int(o['group'])\r\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\r\n  r['group']=group\r\n good=[r for r in data if r['weight']>0];groups=[]\r\n for group in [0,1]:\r\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\r\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\r\ndef readcsv(file):\r\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\r\ndef read_sources(source):\r\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\r\n for year in range(1980,2025):\r\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\r\n person=[]\r\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\r\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\r\n company=[]\r\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\r\n  def fte(suffix):\r\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\r\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\r\n return dict(country=country,person=person,company=company)\r\n_OMITTED_OPTIONS=object()\r\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\r\n options={} if options is _OMITTED_OPTIONS else options\r\n if not isinstance(options,dict):raise ValueError('options object required')\r\n if kind=='country':\r\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\r\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\r\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\r\n if kind=='person':return iv(dict(rows=models[kind]))\r\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\r\n raise ValueError('known actual case required')\r\ndef serial(x):\r\n if isinstance(x,F):return str(x)\r\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\r\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\r\n return x\r\ndef writecsv(file,heads,rows):\r\n with Path(file).open('w',encoding='utf8',newline='') as f:\r\n  w=csv.writer(f);w.writerow(heads)\r\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\r\nAPI='realdata'\r\nINPUT={'kind': 'country'}\r\n\r\ndef run_fixed(api,a,output,source):\r\n import matplotlib\r\n matplotlib.use('svg')\r\n import matplotlib.pyplot as plt\r\n from matplotlib.ticker import MaxNLocator\r\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\r\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\r\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\r\n def add(x,y,s):\r\n  if y is not None:points.append([x,y,s])\r\n if api=='equilibrium':\r\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\r\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\r\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\r\n elif api=='reducedForm':\r\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\r\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\r\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\r\n elif api=='selection':\r\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\r\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\r\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\r\n elif api in ['iv','realdata'] and a.get('kind')!='company':\r\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\r\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\r\n  if good:\r\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\r\n    b=result[key]\r\n    if b is not None:\r\n     alpha=result['means']['y']-b*result['means']['x']\r\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\r\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\r\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\r\n else:\r\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\r\n  for g in result['groups']:\r\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\r\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\r\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\r\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\r\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\r\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\r\n colors=['#355c72','#a55336','#507956']\r\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\r\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\r\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\r\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\r\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,.98),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\r\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\r\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\r\nif __name__=='__main__':\r\n import sys\r\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\r\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\r\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\r\n\r\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\r\n\r\nRereads native-field CSVs, not a stored model or expected result. All sample\r\ncovariances use the common complete, positive-weight frame and divide by its\r\nweight sum. They are arithmetic moments, not unbiased variance estimates.\r\nThe program implements declared arithmetic, not causal-identification testing,\r\nrobust standard errors, weak-IV inference or a published controlled replication.\r\nMissing observed fields remain missing. Required/optional numeric None is never\r\nsilently changed to a default. Production parser/budget limits are separate.\r\n\"\"\"\r\nfrom pathlib import Path\r\nfrom fractions import Fraction as F\r\nimport argparse,csv,json,math\r\n\r\ndef q(value):\r\n if value is None:raise ValueError('explicit null is not a numeric parameter')\r\n return F(value)\r\ndef parse_rows(records,fields):\r\n if not records:raise ValueError('rows required')\r\n ids=set();out=[]\r\n for i,record in enumerate(records):\r\n  rid=str(record.get('id',i))\r\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\r\n  ids.add(rid);w=q(record.get('weight',1))\r\n  if w<0:raise ValueError('negative weight')\r\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\r\n return out\r\ndef mass(rows):return sum((r['weight'] for r in rows),F())\r\ndef mean(rows,key):\r\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\r\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\r\ndef equilibrium(a):\r\n b=q(a['demandSlope']);d=q(a['supplySlope'])\r\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\r\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\r\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\r\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\r\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\r\ndef reduced_form(a):\r\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\r\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\r\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\r\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\r\ndef selection(a):\r\n rr=parse_rows(a['rows'],['y0','y1'])\r\n for r,original in zip(rr,a['rows']):\r\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\r\n  D=int(original['D'])\r\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\r\n  r.update(D=D,effect=r['y1']-r['y0'])\r\n good=[r for r in rr if r['weight']>0];W=mass(good)\r\n if not W:raise ValueError('positive total weight required')\r\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\r\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\r\ndef iv(a):\r\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\r\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\r\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\r\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\r\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\r\ndef did(a):\r\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\r\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\r\n drift=q(a.get('assumedUntreatedTrendDifference',0))\r\n for r,o in zip(data,a['rows']):\r\n  group=int(o['group'])\r\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\r\n  r['group']=group\r\n good=[r for r in data if r['weight']>0];groups=[]\r\n for group in [0,1]:\r\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\r\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\r\ndef readcsv(file):\r\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\r\ndef read_sources(source):\r\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\r\n for year in range(1980,2025):\r\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\r\n person=[]\r\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\r\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\r\n company=[]\r\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\r\n  def fte(suffix):\r\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\r\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\r\n return dict(country=country,person=person,company=company)\r\n_OMITTED_OPTIONS=object()\r\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\r\n options={} if options is _OMITTED_OPTIONS else options\r\n if not isinstance(options,dict):raise ValueError('options object required')\r\n if kind=='country':\r\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\r\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\r\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\r\n if kind=='person':return iv(dict(rows=models[kind]))\r\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\r\n raise ValueError('known actual case required')\r\ndef serial(x):\r\n if isinstance(x,F):return str(x)\r\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\r\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\r\n return x\r\ndef writecsv(file,heads,rows):\r\n with Path(file).open('w',encoding='utf8',newline='') as f:\r\n  w=csv.writer(f);w.writerow(heads)\r\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\r\nAPI='realdata'\r\nINPUT={'kind': 'country'}\r\n\r\ndef run_fixed(api,a,output,source):\r\n import matplotlib\r\n matplotlib.use('svg')\r\n import matplotlib.pyplot as plt\r\n from matplotlib.ticker import MaxNLocator\r\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\r\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\r\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\r\n def add(x,y,s):\r\n  if y is not None:points.append([x,y,s])\r\n if api=='equilibrium':\r\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\r\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\r\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\r\n elif api=='reducedForm':\r\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\r\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\r\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\r\n elif api=='selection':\r\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\r\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\r\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\r\n elif api in ['iv','realdata'] and a.get('kind')!='company':\r\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\r\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\r\n  if good:\r\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\r\n    b=result[key]\r\n    if b is not None:\r\n     alpha=result['means']['y']-b*result['means']['x']\r\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\r\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\r\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\r\n else:\r\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\r\n  for g in result['groups']:\r\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\r\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\r\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\r\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\r\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\r\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\r\n colors=['#355c72','#a55336','#507956']\r\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\r\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\r\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\r\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\r\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,.98),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\r\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\r\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\r\nif __name__=='__main__':\r\n import sys\r\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\r\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\r\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "country"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=45.000000000, firstStageProjection=1.000000000, ivRatio=-0.051694510, olsProjection=-0.051694510\n",
        "stderr": "",
        "summary": {
          "completePositiveWeightUnits": "45.000000000",
          "firstStageProjection": "1.000000000",
          "ivRatio": "-0.051694510",
          "olsProjection": "-0.051694510"
        },
        "plotPoints": [
          {
            "x": "8968002698813/312500000000",
            "y": "-76213195500533/50000000000000",
            "series": "Observed"
          },
          {
            "x": "10675820127/500000000",
            "y": "370191066869959/50000000000000",
            "series": "Observed"
          },
          {
            "x": "719084664006869/100000000000000",
            "y": "846826958565821/100000000000000",
            "series": "Observed"
          },
          {
            "x": "342061419498921/100000000000000",
            "y": "16833507183191/1250000000000",
            "series": "Observed"
          },
          {
            "x": "227395640001863/100000000000000",
            "y": "106366054976723/10000000000000",
            "series": "Observed"
          },
          {
            "x": "122955439607637/50000000000000",
            "y": "158775909552109/20000000000000",
            "series": "Observed"
          },
          {
            "x": "274998096063357/100000000000000",
            "y": "1150298504807/100000000000",
            "series": "Observed"
          },
          {
            "x": "304966077087423/100000000000000",
            "y": "64461044959287/5000000000000",
            "series": "Observed"
          },
          {
            "x": "142921954744321/20000000000000",
            "y": "30332987776793/2500000000000",
            "series": "Observed"
          },
          {
            "x": "2850082722807/500000000000",
            "y": "358250868961921/50000000000000",
            "series": "Observed"
          },
          {
            "x": "214331806432169/25000000000000",
            "y": "100248996213899/10000000000000",
            "series": "Observed"
          },
          {
            "x": "186655809632299/20000000000000",
            "y": "27187434819427/2500000000000",
            "series": "Observed"
          },
          {
            "x": "38833009147199/6250000000000",
            "y": "635159199606441/100000000000000",
            "series": "Observed"
          },
          {
            "x": "480099660215353/100000000000000",
            "y": "174867947935639/25000000000000",
            "series": "Observed"
          },
          {
            "x": "626585950039679/100000000000000",
            "y": "93718357757101/10000000000000",
            "series": "Observed"
          },
          {
            "x": "7001157946207/1562500000000",
            "y": "97358937505409/10000000000000",
            "series": "Observed"
          },
          {
            "x": "492454354292753/100000000000000",
            "y": "799042982526839/100000000000000",
            "series": "Observed"
          },
          {
            "x": "44389318457463/10000000000000",
            "y": "62821926537929/10000000000000",
            "series": "Observed"
          },
          {
            "x": "375679004039653/50000000000000",
            "y": "-49389297463141/10000000000000",
            "series": "Observed"
          },
          {
            "x": "812957254446369/1000000000000000",
            "y": "116172629559591/10000000000000",
            "series": "Observed"
          },
          {
            "x": "225916580080157/100000000000000",
            "y": "92018583880479/10000000000000",
            "series": "Observed"
          },
          {
            "x": "6354024810903/1562500000000",
            "y": "118148390080589/25000000000000",
            "series": "Observed"
          },
          {
            "x": "276226210296599/100000000000000",
            "y": "774399895319569/100000000000000",
            "series": "Observed"
          },
          {
            "x": "351487451459939/100000000000000",
            "y": "307472661826947/100000000000000",
            "series": "Observed"
          },
          {
            "x": "359066298882577/100000000000000",
            "y": "25918184298667/5000000000000",
            "series": "Observed"
          },
          {
            "x": "275379162735039/100000000000000",
            "y": "108955916834289/25000000000000",
            "series": "Observed"
          },
          {
            "x": "5605850712973/2500000000000",
            "y": "262250275290171/50000000000000",
            "series": "Observed"
          },
          {
            "x": "63364345534483/25000000000000",
            "y": "58419633918717/10000000000000",
            "series": "Observed"
          },
          {
            "x": "14605926735419/3125000000000",
            "y": "300440451679569/100000000000000",
            "series": "Observed"
          },
          {
            "x": "275649654493929/100000000000000",
            "y": "16397235128359/20000000000000",
            "series": "Observed"
          },
          {
            "x": "58785730531137/20000000000000",
            "y": "698166138853071/100000000000000",
            "series": "Observed"
          },
          {
            "x": "40259650043609/10000000000000",
            "y": "4610040075369/1250000000000",
            "series": "Observed"
          },
          {
            "x": "218707104433313/100000000000000",
            "y": "127383275284121/50000000000000",
            "series": "Observed"
          },
          {
            "x": "32533688636853/25000000000000",
            "y": "16456979771721/5000000000000",
            "series": "Observed"
          },
          {
            "x": "127477446401321/100000000000000",
            "y": "80367004920777/25000000000000",
            "series": "Observed"
          },
          {
            "x": "706331772455749/1000000000000000",
            "y": "146014633650617/50000000000000",
            "series": "Observed"
          },
          {
            "x": "971685739912167/1000000000000000",
            "y": "63430549796787/20000000000000",
            "series": "Observed"
          },
          {
            "x": "97216615393183/50000000000000",
            "y": "858297940993/250000000000",
            "series": "Observed"
          },
          {
            "x": "29516787000529/20000000000000",
            "y": "317611568177327/100000000000000",
            "series": "Observed"
          },
          {
            "x": "76600060721627/200000000000000",
            "y": "9255208423819/4000000000000",
            "series": "Observed"
          },
          {
            "x": "537288023411737/1000000000000000",
            "y": "-350121158771053/500000000000000",
            "series": "Observed"
          },
          {
            "x": "249833333333339/100000000000000",
            "y": "461296795454287/100000000000000",
            "series": "Observed"
          },
          {
            "x": "508951365062841/100000000000000",
            "y": "272756456708991/100000000000000",
            "series": "Observed"
          },
          {
            "x": "35974562502901/10000000000000",
            "y": "158301467403629/100000000000000",
            "series": "Observed"
          },
          {
            "x": "116087164321771/50000000000000",
            "y": "100180550919493/50000000000000",
            "series": "Observed"
          },
          {
            "x": "76600060721627/200000000000000",
            "y": "74316557840514908164146157657354457622274341294381/12469319930908015671949485112298174000000000000000",
            "series": "OLS projection"
          },
          {
            "x": "8968002698813/312500000000",
            "y": "10193653066978041023300194356690816032492278758807/2267149078346911940354451838599668000000000000000",
            "series": "OLS projection"
          },
          {
            "x": "76600060721627/200000000000000",
            "y": "74316557840514908164146157657354457622274341294381/12469319930908015671949485112298174000000000000000",
            "series": "IV moment line"
          },
          {
            "x": "8968002698813/312500000000",
            "y": "10193653066978041023300194356690816032492278758807/2267149078346911940354451838599668000000000000000",
            "series": "IV moment line"
          }
        ],
        "plotFile": "econ23-fixed-results/realdata-country-python/plot.svg",
        "plotSHA256": "2e634e17293e25e85aacb6a323e0db26ebd660b04cff50d3e5c8f454d29bac64",
        "files": [
          {
            "file": "econ23-fixed-results/realdata-country-python/full.json",
            "sha256": "4006d0906305d604281c676de44243362dd0566215e36ce794ef75377ffafaab"
          },
          {
            "file": "econ23-fixed-results/realdata-country-python/plot-points.csv",
            "sha256": "094e15e95447280a32f6501b7a4d3abc116c0a9a872bd92216273a1d0f70e798"
          },
          {
            "file": "econ23-fixed-results/realdata-country-python/plot.svg",
            "sha256": "2e634e17293e25e85aacb6a323e0db26ebd660b04cff50d3e5c8f454d29bac64"
          },
          {
            "file": "econ23-fixed-results/realdata-country-python/summary.csv",
            "sha256": "933bf1d40634b02b4c55f8bb50d5ec3dd3d92c23332435d7c25ffc315f68ddce"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "person": {
        "api": "realdata",
        "variant": "person",
        "language": "python",
        "codeFile": "econ23-code/realdata-person.py",
        "codeSHA256": "cbc47ab768f7b1fd7d0a8ac8b03638e3f0a000966cdb5b7230605a9ca3797cac",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\r\n\r\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\r\n\r\nRereads native-field CSVs, not a stored model or expected result. All sample\r\ncovariances use the common complete, positive-weight frame and divide by its\r\nweight sum. They are arithmetic moments, not unbiased variance estimates.\r\nThe program implements declared arithmetic, not causal-identification testing,\r\nrobust standard errors, weak-IV inference or a published controlled replication.\r\nMissing observed fields remain missing. Required/optional numeric None is never\r\nsilently changed to a default. Production parser/budget limits are separate.\r\n\"\"\"\r\nfrom pathlib import Path\r\nfrom fractions import Fraction as F\r\nimport argparse,csv,json,math\r\n\r\ndef q(value):\r\n if value is None:raise ValueError('explicit null is not a numeric parameter')\r\n return F(value)\r\ndef parse_rows(records,fields):\r\n if not records:raise ValueError('rows required')\r\n ids=set();out=[]\r\n for i,record in enumerate(records):\r\n  rid=str(record.get('id',i))\r\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\r\n  ids.add(rid);w=q(record.get('weight',1))\r\n  if w<0:raise ValueError('negative weight')\r\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\r\n return out\r\ndef mass(rows):return sum((r['weight'] for r in rows),F())\r\ndef mean(rows,key):\r\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\r\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\r\ndef equilibrium(a):\r\n b=q(a['demandSlope']);d=q(a['supplySlope'])\r\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\r\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\r\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\r\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\r\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\r\ndef reduced_form(a):\r\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\r\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\r\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\r\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\r\ndef selection(a):\r\n rr=parse_rows(a['rows'],['y0','y1'])\r\n for r,original in zip(rr,a['rows']):\r\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\r\n  D=int(original['D'])\r\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\r\n  r.update(D=D,effect=r['y1']-r['y0'])\r\n good=[r for r in rr if r['weight']>0];W=mass(good)\r\n if not W:raise ValueError('positive total weight required')\r\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\r\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\r\ndef iv(a):\r\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\r\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\r\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\r\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\r\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\r\ndef did(a):\r\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\r\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\r\n drift=q(a.get('assumedUntreatedTrendDifference',0))\r\n for r,o in zip(data,a['rows']):\r\n  group=int(o['group'])\r\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\r\n  r['group']=group\r\n good=[r for r in data if r['weight']>0];groups=[]\r\n for group in [0,1]:\r\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\r\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\r\ndef readcsv(file):\r\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\r\ndef read_sources(source):\r\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\r\n for year in range(1980,2025):\r\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\r\n person=[]\r\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\r\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\r\n company=[]\r\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\r\n  def fte(suffix):\r\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\r\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\r\n return dict(country=country,person=person,company=company)\r\n_OMITTED_OPTIONS=object()\r\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\r\n options={} if options is _OMITTED_OPTIONS else options\r\n if not isinstance(options,dict):raise ValueError('options object required')\r\n if kind=='country':\r\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\r\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\r\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\r\n if kind=='person':return iv(dict(rows=models[kind]))\r\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\r\n raise ValueError('known actual case required')\r\ndef serial(x):\r\n if isinstance(x,F):return str(x)\r\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\r\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\r\n return x\r\ndef writecsv(file,heads,rows):\r\n with Path(file).open('w',encoding='utf8',newline='') as f:\r\n  w=csv.writer(f);w.writerow(heads)\r\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\r\nAPI='realdata'\r\nINPUT={'kind': 'person'}\r\n\r\ndef run_fixed(api,a,output,source):\r\n import matplotlib\r\n matplotlib.use('svg')\r\n import matplotlib.pyplot as plt\r\n from matplotlib.ticker import MaxNLocator\r\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\r\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\r\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\r\n def add(x,y,s):\r\n  if y is not None:points.append([x,y,s])\r\n if api=='equilibrium':\r\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\r\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\r\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\r\n elif api=='reducedForm':\r\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\r\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\r\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\r\n elif api=='selection':\r\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\r\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\r\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\r\n elif api in ['iv','realdata'] and a.get('kind')!='company':\r\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\r\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\r\n  if good:\r\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\r\n    b=result[key]\r\n    if b is not None:\r\n     alpha=result['means']['y']-b*result['means']['x']\r\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\r\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\r\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\r\n else:\r\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\r\n  for g in result['groups']:\r\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\r\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\r\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\r\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\r\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\r\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\r\n colors=['#355c72','#a55336','#507956']\r\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\r\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\r\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\r\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\r\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,.98),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\r\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\r\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\r\nif __name__=='__main__':\r\n import sys\r\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\r\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\r\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\r\n\r\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\r\n\r\nRereads native-field CSVs, not a stored model or expected result. All sample\r\ncovariances use the common complete, positive-weight frame and divide by its\r\nweight sum. They are arithmetic moments, not unbiased variance estimates.\r\nThe program implements declared arithmetic, not causal-identification testing,\r\nrobust standard errors, weak-IV inference or a published controlled replication.\r\nMissing observed fields remain missing. Required/optional numeric None is never\r\nsilently changed to a default. Production parser/budget limits are separate.\r\n\"\"\"\r\nfrom pathlib import Path\r\nfrom fractions import Fraction as F\r\nimport argparse,csv,json,math\r\n\r\ndef q(value):\r\n if value is None:raise ValueError('explicit null is not a numeric parameter')\r\n return F(value)\r\ndef parse_rows(records,fields):\r\n if not records:raise ValueError('rows required')\r\n ids=set();out=[]\r\n for i,record in enumerate(records):\r\n  rid=str(record.get('id',i))\r\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\r\n  ids.add(rid);w=q(record.get('weight',1))\r\n  if w<0:raise ValueError('negative weight')\r\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\r\n return out\r\ndef mass(rows):return sum((r['weight'] for r in rows),F())\r\ndef mean(rows,key):\r\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\r\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\r\ndef equilibrium(a):\r\n b=q(a['demandSlope']);d=q(a['supplySlope'])\r\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\r\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\r\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\r\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\r\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\r\ndef reduced_form(a):\r\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\r\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\r\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\r\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\r\ndef selection(a):\r\n rr=parse_rows(a['rows'],['y0','y1'])\r\n for r,original in zip(rr,a['rows']):\r\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\r\n  D=int(original['D'])\r\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\r\n  r.update(D=D,effect=r['y1']-r['y0'])\r\n good=[r for r in rr if r['weight']>0];W=mass(good)\r\n if not W:raise ValueError('positive total weight required')\r\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\r\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\r\ndef iv(a):\r\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\r\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\r\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\r\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\r\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\r\ndef did(a):\r\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\r\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\r\n drift=q(a.get('assumedUntreatedTrendDifference',0))\r\n for r,o in zip(data,a['rows']):\r\n  group=int(o['group'])\r\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\r\n  r['group']=group\r\n good=[r for r in data if r['weight']>0];groups=[]\r\n for group in [0,1]:\r\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\r\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\r\ndef readcsv(file):\r\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\r\ndef read_sources(source):\r\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\r\n for year in range(1980,2025):\r\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\r\n person=[]\r\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\r\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\r\n company=[]\r\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\r\n  def fte(suffix):\r\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\r\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\r\n return dict(country=country,person=person,company=company)\r\n_OMITTED_OPTIONS=object()\r\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\r\n options={} if options is _OMITTED_OPTIONS else options\r\n if not isinstance(options,dict):raise ValueError('options object required')\r\n if kind=='country':\r\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\r\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\r\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\r\n if kind=='person':return iv(dict(rows=models[kind]))\r\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\r\n raise ValueError('known actual case required')\r\ndef serial(x):\r\n if isinstance(x,F):return str(x)\r\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\r\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\r\n return x\r\ndef writecsv(file,heads,rows):\r\n with Path(file).open('w',encoding='utf8',newline='') as f:\r\n  w=csv.writer(f);w.writerow(heads)\r\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\r\nAPI='realdata'\r\nINPUT={'kind': 'person'}\r\n\r\ndef run_fixed(api,a,output,source):\r\n import matplotlib\r\n matplotlib.use('svg')\r\n import matplotlib.pyplot as plt\r\n from matplotlib.ticker import MaxNLocator\r\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\r\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\r\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\r\n def add(x,y,s):\r\n  if y is not None:points.append([x,y,s])\r\n if api=='equilibrium':\r\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\r\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\r\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\r\n elif api=='reducedForm':\r\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\r\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\r\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\r\n elif api=='selection':\r\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\r\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\r\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\r\n elif api in ['iv','realdata'] and a.get('kind')!='company':\r\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\r\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\r\n  if good:\r\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\r\n    b=result[key]\r\n    if b is not None:\r\n     alpha=result['means']['y']-b*result['means']['x']\r\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\r\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\r\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\r\n else:\r\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\r\n  for g in result['groups']:\r\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\r\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\r\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\r\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\r\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\r\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\r\n colors=['#355c72','#a55336','#507956']\r\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\r\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\r\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\r\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\r\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,.98),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\r\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\r\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\r\nif __name__=='__main__':\r\n import sys\r\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\r\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\r\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "person"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=3010.000000000, firstStageProjection=0.829018980, ivRatio=0.188062635, olsProjection=0.052094237\n",
        "stderr": "",
        "summary": {
          "completePositiveWeightUnits": "3010.000000000",
          "firstStageProjection": "0.829018980",
          "ivRatio": "0.188062635",
          "olsProjection": "0.052094237"
        },
        "plotPoints": [
          {
            "x": "7",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "659167373/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "633682573/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "40063593/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62441669/10000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "107597947/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "339785289/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "648920493/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "685012617/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "641999493/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "32017871/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "22638211/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "374777097/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "644888939/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "33359613/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "612468339/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "671417053/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "110825271/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "685012617/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "70440329/10000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "36129647/6250000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "545958551/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "643615037/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "292032083/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "293323403/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "649072353/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "160783277/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "330197191/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "7043487/1250000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "607304453/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "32790989/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "634738921/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "660665019/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "638350663/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "536129217/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "735436233/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "665157187/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "158640909/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "322047327/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "317805383/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "666949809/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "138393677/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "663068339/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "56454469/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "352070583/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "26788137/4000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "329720673/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "127534539/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "53082677/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "134088287/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "642810527/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "623832463/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "701301579/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "141019789/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "67178047/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "682762923/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "349050287/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "170059869/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "326251483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "345637141/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "131723433/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "34396779/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "615697899/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "582008293/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "594803499/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "32769667/5000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "614418563/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "682871207/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "333791161/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158640909/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "32790989/5000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163561799/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "660258789/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "22638211/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "129662147/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "557972983/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "159671983/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "614203741/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "282624459/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "672262979/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "663725803/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "667834211/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "150342879/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "339448587/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "317805383/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "320918247/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "624222327/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "612468339/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "342875703/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "87707621/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "566642669/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "35714137/5000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "320918247/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "562762111/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "90922329/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "345137137/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "67546041/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "653087763/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "168095811/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "322523521/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "653524127/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "326251483/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "650727771/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "693342303/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "141747023/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "141019789/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "157702461/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5590763/781250",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "127534539/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "307316463/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "341705437/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "632076829/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "298178967/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "667834211/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "615485809/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "53082677/10000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "123308357/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "491265489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "359345051/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "631173481/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "678105763/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "663331843/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "656244409/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "317805383/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313738101/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "664639051/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "149217689/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "26788137/4000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "157427733/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "7981493/1250000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "676157277/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "623441073/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "82932917/12500000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "620050917/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "152451857/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "40063593/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "670073111/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289344869/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "670318811/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "702553831/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "328614127/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319090801/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "76197807/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "619031541/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "130878237/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "632076829/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "650428817/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "77848893/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "663068339/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "137873127/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "565599181/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "544241771/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "82136037/12500000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "655250789/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "676619171/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "682110747/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "43567063/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "323073409/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "282624459/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "298178967/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "691770561/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "688243747/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "122754541/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "361744921/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "599396143/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5768321/1000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "624222327/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "33359613/6250000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "141667757/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "82136037/12500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "3157679/500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "79516281/12500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "336729583/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "30246567/4000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "334604187/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "292032083/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "672982407/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "633327963/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "362567249/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "61737861/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "337613519/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "330197191/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "696413561/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "634913899/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "167271057/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "660665019/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "593753621/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "163561799/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "346082909/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "35176343/5000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "23261449/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "691770561/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "21064123/3125000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "656526497/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "335465217/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "610255859/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "695559261/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "177293553/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "16341729/2500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "64738907/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "771601527/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "90922329/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "89255663/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "661204103/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "21064123/3125000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670073111/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "632972091/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "282624459/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "15199833/2500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "63630281/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "127534539/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "574300319/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "116754609/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "631896811/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "327482537/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "30246567/4000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "355166103/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "330669211/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "306343459/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "647234629/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "330669211/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670318811/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "324384201/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "674641213/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "649677499/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "169752431/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "544241771/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "668710861/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "313926071/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "665286303/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "123308357/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "346082909/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "632076829/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "156727407/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "141019789/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "675110147/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "30858503/5000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "689669433/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "610255859/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "21592979/3125000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "712367279/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "170636501/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "634738921/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "141019789/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "61737861/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "673221071/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "724565507/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "656526497/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "298050267/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163344721/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "322285991/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "695081477/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "133211503/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "649072353/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "691770561/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "121088787/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "696602419/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "602586597/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "9685123/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "567332327/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "329720673/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "619031541/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "582008293/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "131723433/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "341489687/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "624222327/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "43567063/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161458457/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5160389/781250",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "620050917/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "322206563/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "150342879/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "330669211/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157702461/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "289344869/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "277647979/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "129198089/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "622257627/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "691770561/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "166642093/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "315130949/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "134380263/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "25344521/5000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "57170277/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "311622401/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "90922329/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "67787849/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "676041469/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "660665019/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "169752431/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "306343459/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "661204103/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "169752431/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "32017871/5000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "8268407/1250000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "316396839/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "302486673/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "12941599/2000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "25574363/4000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "156727407/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "134904727/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "622653667/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "623832463/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "25184763/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158064131/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "118377877/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "318495049/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "62441669/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "298307337/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7043487/1250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "16341729/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "291740537/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "587493073/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "11136689/2000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "660665019/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "291740537/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "562040087/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "109529271/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7994077/1250000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "499043259/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7043487/1250000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "691770561/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "624804287/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "639024067/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "58230459/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "286015589/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "593224519/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "656244409/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "601859321/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "143993567/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "657368017/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "525749537/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "167021367/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "682871207/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "693244789/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622059017/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "123308357/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "649677499/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "656103067/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "683303173/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "80865629/12500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "693342303/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "146764763/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "682762923/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "317106071/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "350875307/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "656807791/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "341489687/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "280105941/50000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "168125841/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "177251921/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "159118769/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "653087763/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "628599809/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "16341729/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651767127/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "615909539/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "160742987/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "29674471/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "17165817/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "76113061/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "163344721/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "62166061/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "344428623/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "656103067/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "347492823/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "82932917/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "162381639/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "157427733/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "323073409/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "284686607/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "685329909/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "160742987/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "562401751/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "82361581/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "614203741/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "656526497/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "168125841/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "90922329/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "720489251/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "156249381/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "612249281/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "150342879/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "632614947/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "693342303/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "349328323/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "177293553/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "23184231/4000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "742833319/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5590763/781250",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "76197807/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "307316463/50000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "650428817/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "565599181/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "665286303/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "139225921/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "162904827/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "326906991/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "90922329/12500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "38765847/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "2568389/390625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "80826809/12500000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "652062113/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "19626237/3125000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "591350301/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "648920493/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "573979291/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "336729583/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "40576499/6250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "32790989/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "28383769/5000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "90922329/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "177293553/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "147592643/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "167271057/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "598645201/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "675110147/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "292177221/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "632972091/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "40799737/6250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "615060277/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "82361581/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "26506871/4000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "323073409/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "726192709/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "82932917/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "701301579/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "663725803/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "352592781/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "631896811/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "157427733/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "676157277/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "320918247/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "156297597/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "656103067/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "335343117/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "32769667/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "359345051/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "77632501/12500000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "649677499/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "347059503/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "698378997/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "160742987/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "696413561/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "666695679/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "618414889/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "329101257/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "130878237/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "157702461/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "333791161/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "30246567/4000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "333791161/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "170059869/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "129662147/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "119012851/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "714203657/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "661606519/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "325512917/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "43066307/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "177293553/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "67310181/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "76197807/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "167021367/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "293886789/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "476217393/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "78551677/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "627664349/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "473369/78125",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "349879799/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "1210029/160000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "134904727/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "154030183/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "648616079/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "352375861/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "581114099/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "32769667/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "338654019/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "323073409/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "350198707/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "682871207/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "65482191/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "632076829/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "127432237/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "133211503/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "648616079/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5590763/781250",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "647234629/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "136874999/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "628599809/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "141747023/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "525749537/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "335343117/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "670073111/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "82361581/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "702553831/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "74986707/12500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "32790989/5000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "582008293/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "168125841/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "525749537/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "659304453/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "33564781/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "13199741/2000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "291447281/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "610255859/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "107597947/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "293181559/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138314469/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "129662147/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "668835471/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158640909/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "80865629/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "152451857/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "319006127/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "631716469/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "328474071/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "660665019/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651767127/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "167021367/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "156297597/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "597380961/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "68145429/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "2374079/390625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "626530121/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "1084107/200000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "656667243/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "26672913/4000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "306014871/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "562401751/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "643615037/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "654678541/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "29674471/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "615909539/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "619644413/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "682871207/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "151536423/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "591350301/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "622653667/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "642810527/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "297139969/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "127534539/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "618208491/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "168185793/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "619644413/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "681783057/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "672262979/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "607304453/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "544241771/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "9342009/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "707918439/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62166061/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "145427779/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "633682573/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "687109129/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "722548147/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "641181827/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "650727771/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "152451857/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "618414889/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "656526497/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "68596149/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "61737861/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "612468339/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "65971457/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "115981853/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150403929/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "309310431/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "588332239/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "115981853/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "19389243/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "648157713/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329101257/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163919459/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "624222327/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "643294009/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "648157713/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "80826809/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "129965643/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "631896811/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "64645883/10000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "359269351/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622257627/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "133211503/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "40799737/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "644254017/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "631716469/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "32017871/5000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "640687999/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "346426891/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "636818719/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163990381/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "648616079/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "40799737/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "562040087/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "656103067/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "666949809/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "143692583/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329101257/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "663331843/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "607304453/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "141667757/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "591350301/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "607534603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "580513497/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323073409/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "329101257/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "129965643/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "339952793/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "333791161/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "628971557/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "339952793/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "341489687/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "124609629/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "341705437/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "32790989/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "558349631/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "171146997/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664118217/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "656103067/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "40799737/6250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "326251483/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "682219739/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "330197191/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "706219163/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "663987583/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "648920493/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "639024067/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "681234509/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "695559261/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "306014871/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "341489687/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "633327963/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "361491939/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "666949809/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "298178967/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "587211779/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "670318811/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "607534603/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "532787617/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "618414889/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "331600089/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "345137137/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "706219163/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "574939299/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "681892407/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "129965643/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "66631327/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "279362433/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "587211779/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "633327963/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "666695679/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "177293553/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150403929/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "591350301/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "83384579/12500000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "713169851/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "242601513/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "598141421/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "322285991/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "618414889/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157702461/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "118377877/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "329720673/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "80290587/12500000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "615485809/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "606378521/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "279362433/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "606842559/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313738101/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "127534539/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "336729583/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "170636501/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "321324423/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "573979291/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "17165817/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4410743/800000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "326906991/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "610702289/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "713089883/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "619440539/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "637331979/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "289344869/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "606378521/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "634738921/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "641181827/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "328474071/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "656526497/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "603548143/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "80168237/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "16606217/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "160742987/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "624610677/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "64645883/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "317106071/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "688550967/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "133160221/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "609356977/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "133005581/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "170059869/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "618414889/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "339785289/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "139225921/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "17096013/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "317106071/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "172366751/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "64738907/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "610702289/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "63630281/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "253758691/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "676388491/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "326324743/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "87707621/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "565599181/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "694601399/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "581413053/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "156249381/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "656385553/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "160863663/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "569709349/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "612905021/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "598141421/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "159671983/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "694601399/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "65482191/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "328474071/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "696413561/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "319006127/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "322523521/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "666949809/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "168095811/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "628971557/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "329101257/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "305684109/50000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "597380961/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "689669433/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "677992191/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "340396747/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "587493073/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "562762111/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "28047359/5000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "16004793/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "582008293/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "26517453/4000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "631716469/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "606842559/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "167021367/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "669332367/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "17096013/2500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "160863663/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "579301361/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "682762923/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "314578457/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "612905021/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "618414889/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "622257627/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "589440283/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "129662147/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "67787849/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "653233429/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "599645209/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "473369/78125",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "131723433/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "41620587/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "55759491/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "688755257/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "292032083/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "633327963/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "122754541/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "633682573/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161458457/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "650727771/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "296078921/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "79054487/12500000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "79054487/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "115981853/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "168894223/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "547227067/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "293886789/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617794411/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "343085567/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "141747023/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "2625086/390625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "25574363/4000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "160742987/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "61484683/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "663331843/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "316396839/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "518738581/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "71685799/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "123308357/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "665286303/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "151536423/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "607534603/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "302486673/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "619236249/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "291447281/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "159118769/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62441669/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "695939851/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "731455283/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "290105919/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "149598407/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "21064123/3125000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "331600089/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "43358213/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "677536609/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "317106071/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "313926071/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "32017871/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "324384201/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7043487/1250000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "335343117/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "643615037/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "32017871/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "651323011/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "67787849/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "667456139/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "578996017/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "666695679/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "582008293/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "151536423/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "68916259/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "330669211/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "292177221/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "631716469/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "557215403/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "330669211/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "643615037/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670073111/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "618414889/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "336729583/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "616751649/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "62441669/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "34657359/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "657646957/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "667959919/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150946773/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "606610809/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "163235471/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "631173481/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "656103067/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "312979073/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "149598407/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "338539471/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "29674471/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "589715387/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "314578457/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "588610403/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "292177221/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "695844839/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "177293553/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "563835467/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "484418709/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "723921497/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "604025471/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "306014871/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "81171923/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "305684109/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "62126061/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "614203741/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "295404147/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "612468339/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "566642669/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "108232921/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "589440283/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "2716861/500000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "34095757/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "614203741/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "191039111/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651914729/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "32769667/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "587211779/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "588332239/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "73188399/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "568017261/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "609356977/100000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "139960549/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "639024067/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313738101/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319090801/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622059017/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "722548147/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "32769667/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "76197807/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "316396839/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "714598447/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "636818719/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "471849887/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "30246567/4000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "141019789/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "186655689/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "659304453/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "165030753/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "56454469/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150706963/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "625766759/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163990381/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "150342879/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "301534263/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "666695679/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "616961073/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "282974111/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "110825271/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "39134323/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "28383769/5000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "681234509/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "293323403/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "352592781/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "133211503/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "301534263/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "589715387/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "588053299/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "156727407/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570044357/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "314578457/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "156727407/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "528826703/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662406523/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "152451857/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "511799381/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "152451857/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "598645201/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "312979073/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "139960549/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "57365723/10000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "170059869/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "282624459/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "562762111/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "74640773/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "623636959/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "643615037/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "549716823/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "589440283/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "640687999/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "663331843/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "19389243/3125000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "134380263/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "279362433/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "285355513/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "648920493/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "624222327/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "286015589/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "606378521/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "460517019/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "130911049/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "587211779/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "279362433/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "279362433/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "637331979/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "630078579/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "126630037/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "339561073/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "301534263/50000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "326324743/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "57365723/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "129965643/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "565599181/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "165233731/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "160863663/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "16004793/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "115981853/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "40799737/6250000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "699484999/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "123308357/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "342823099/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "704053639/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "610479323/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "80290587/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "619440539/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150706963/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "352592781/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "79054487/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "293039311/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329170461/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "634388043/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "58230459/10000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "35393503/6250000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "10535751/1562500",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "338654019/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "8885899/1562500",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "566642669/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "569709349/100000000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "350016723/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "614203741/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "557972983/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "673221071/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "545958551/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "263905733/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "581114099/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "15295243/2500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "685118493/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "567332327/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "154030183/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "113807189/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "604025471/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "575574221/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "685012617/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "597380961/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "9685123/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "279549349/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "563835467/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "557215403/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "138393677/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "168125841/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "57651911/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "603548143/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "125344011/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "156297597/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "581413053/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "675110147/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "575574221/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "672262979/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "722548147/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "305573367/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "40799737/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "607534603/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "675110147/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "34657359/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "76113061/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "600388707/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150403929/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "138393677/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "305684109/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "298050267/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "9685123/1562500",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "162115881/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "656385553/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "623636959/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "602586597/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "615485809/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "619440539/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "330669211/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "640687999/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "633327963/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "671052311/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "26788137/4000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "29621279/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "642810527/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "127432237/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "318751241/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313926071/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "162115881/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "321243451/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128005149/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "653087763/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "31440237/6250000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "638856141/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "57170277/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "564190707/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "656667243/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "686589107/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "76197807/12500000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "545958551/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "552942909/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "298307337/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "35393503/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "588610403/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "597380961/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "130911049/25000000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "282624459/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "664639051/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "79054487/12500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "373738609/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "130878237/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "619236249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "311622401/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "335343117/50000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6228511/1000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "640687999/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "670073111/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "282624459/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "348677151/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "23123119/3125000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "675693239/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "331402069/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "350425259/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "567332327/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "580513497/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "625382881/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "501063529/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "339785289/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "36110327/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "548479693/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "663068339/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "151806939/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "130878237/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "619644413/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "633682573/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "291447281/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "569709349/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "350016723/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "640687999/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "318921309/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "298307337/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "609356977/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "656103067/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "166418163/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "623441073/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "152282747/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "357535073/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "600388707/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "7043487/1250000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "380120067/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "676388491/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "677992191/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "80168237/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "499721227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "671417053/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "62441669/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "656807791/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "673933663/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "135711753/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "674641213/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "330197191/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "667834211/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "79516281/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "676734313/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "361672771/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "147592643/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "649677499/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "673933663/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "324384201/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "177251921/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "664639051/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "116754609/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "765681009/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "346817137/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "638856141/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "168125841/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "511799381/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "307316463/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "80826809/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "650128967/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "166642093/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "130055801/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "654678541/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "163235471/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "602586597/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "132428113/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "544241771/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "717701877/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "696413561/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "322047327/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "43478409/6250000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "43066307/6250000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5590763/781250",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "335343117/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "657925121/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "136874999/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "133211503/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "345187363/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "127329409/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "544241771/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "628971557/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "644254017/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651323011/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "544241771/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "657368017/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "565599181/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "574300319/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "350425259/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "636818719/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "321324423/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "562401751/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "163489649/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "633327963/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "143948707/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "337613519/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "643935037/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "181861989/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "145427779/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "61737861/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "30858503/5000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "347252553/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "349696649/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "292466239/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "13516189/2000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "564190707/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327482537/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "19626237/3125000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "84212087/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "3157679/500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "346082909/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "664768837/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "68145429/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "330669211/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651323011/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "664639051/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "82361581/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "650128967/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "163344721/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "316396839/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "650727771/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "658755001/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "141019789/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "604500531/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "348442519/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "706902343/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "674758653/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "80168237/12500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "177251921/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "346817137/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "675110147/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "131806021/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "693244789/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "141019789/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "43066307/6250000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "82361581/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "627664349/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "566642669/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "350153273/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "40576499/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "557215403/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "110825271/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "650727771/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "695559261/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "376038821/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "163344721/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "30858503/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "72898531/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "680903931/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "293039311/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "665286303/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "638350663/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "660665019/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "313926071/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "723993259/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "324384201/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "634913899/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "643615037/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "152282747/25000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "314578457/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "336729583/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "658479139/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "158064131/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "581114099/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "623441073/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "623636959/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "573979291/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "650727771/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "322365293/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "650128967/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "647234629/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "292177221/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "673340189/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "170582153/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "659304453/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "610479323/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "123600333/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "135711753/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "65971457/10000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "612905021/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "327482537/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "166642093/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "341489687/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "610702289/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "326324743/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "625766759/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "78667741/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "674758653/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7880561/1250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "348677151/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5160389/781250",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "72984451/10000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "170059869/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "314578457/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "133440659/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "63403593/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "587493073/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "313738101/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "49698133/10000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "309310431/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "25574363/4000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "334975017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "347492823/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "668461173/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "334975017/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "132428113/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "568357977/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "35306089/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "61737861/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "29674471/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "124609629/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329170461/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "177293553/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "633327963/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "82223267/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "349328323/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "132428113/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "587493073/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "599396143/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "282974111/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "35833383/6250000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "635957387/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "515329159/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617794411/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "168125841/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "281560589/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "248836687/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "670563909/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "601126717/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "626530121/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "635957387/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "160742987/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "63630281/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "352592781/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "80290587/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "36110327/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "347252553/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "619644413/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "298050267/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "660258789/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7994077/1250000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "175771437/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "639859493/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "569709349/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "545958551/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "654678541/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "141747023/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "275469417/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "648616079/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "656667243/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "639024067/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "635957387/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "651914729/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "146764763/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "675693239/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "19626237/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "286504989/50000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "314578457/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "292032083/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5768321/1000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "29674471/5000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "130911049/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "256198199/50000000",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "524702407/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "25340217/4000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "643615037/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "587211779/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "137015973/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "603548143/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "693342303/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "8885899/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "9824779/1562500",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "656667243/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "2716861/500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "571373281/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "662406523/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "21064123/3125000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "30858503/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "151536423/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "619440539/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "573979291/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "280105941/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "297139969/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "614203741/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "306014871/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "32790989/5000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "35393503/6250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "151536423/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "313738101/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "612468339/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "302368609/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "604025471/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "598645201/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "598645201/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "659850903/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163344721/25000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "535658627/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "306014871/50000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "327482537/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "589715387/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "160783277/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "72898531/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "619236249/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "117997947/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "69363451/12500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "35393503/6250000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "676388491/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "630627529/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "607073773/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7880561/1250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "587211779/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "10535751/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "566642669/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "612468339/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "656667243/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "80942909/12500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "322523521/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "638350663/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "663856779/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "588332239/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "74986707/12500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "122754541/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "598141421/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "562762111/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "150706963/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "90922329/12500000",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "241415687/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "156393751/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "558349631/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "291447281/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "268298801/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163344721/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "612468339/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "642162227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "659578051/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "25468751/5000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "9685123/1562500",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "623441073/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "633682573/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "62441669/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "615485809/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "581413053/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "64645883/10000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "158772143/25000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "588610403/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "582600011/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "63630281/10000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "36071507/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "152451857/25000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "552942909/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150946773/25000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "575890177/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "659167373/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "574939299/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "107872551/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "545958551/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "298307337/50000000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "123600333/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "614203741/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "156727407/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "152451857/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "557972983/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "288102569/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "643935037/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "29674471/5000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "668835471/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "610255859/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "57651911/10000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "599396143/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "301654311/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "80290587/12500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "586929691/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "557972983/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "121088787/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "316396839/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "566642669/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "597380961/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "292321939/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5590763/781250",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "676272951/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "31521407/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150158829/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "21064123/3125000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "660800063/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "82361581/12500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "687729607/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "132428113/20000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "37508843/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "80290587/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "247791353/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "604500531/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "325512917/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "586929691/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "613122649/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "606842559/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "290105919/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "127432237/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5768321/1000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "330197191/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "323151473/50000000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150158829/25000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "1292621/250000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "28383769/5000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "133717219/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "25129067/4000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "604500531/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "79054487/12500000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "309310431/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "589440283/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "247791353/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "610479323/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "163990381/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "19626237/3125000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "556068163/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "44390621/6250000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "597635091/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "56167711/10000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "587493073/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "135711753/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "525749537/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "604025471/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "589715387/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "293323403/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "301534263/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "86004801/12500000",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "573979291/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "561312811/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "607534603/100000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "329720673/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "139960549/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "1292621/250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "473369/78125",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "660665019/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "28047359/5000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "644888939/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "566642669/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "543807931/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "9342009/1562500",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "634913899/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "157747957/25000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "589440283/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "460517019/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "141747023/25000000",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "168125841/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "607534603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "580814249/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "57235851/10000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "158772143/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "35393503/6250000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "122754541/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "298178967/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "350425259/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "550125821/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "588053299/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "293886789/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "150342879/25000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "582008293/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7043487/1250000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "312979073/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "326906991/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "605208917/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "147221949/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "3147633/500000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "319090801/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "150946773/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "36942479/6250000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "608221891/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "642810527/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "677422389/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "51629/8000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "574620319/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "42208987/6250000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "594803499/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "334728103/50000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "622653667/100000000",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "165267401/25000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "123308357/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "120304609/25000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "333854173/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "13540251/2500000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "103859137/20000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "289191259/50000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "150342879/25000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "628971557/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "586929691/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "654103/100000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "604025471/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "590263333/100000000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "293039311/50000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "170059869/25000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "22907391/4000000",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "15408287/2500000",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "291447281/50000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "122754541/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "35953579/6250000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "553733427/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "589715387/100000000",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "318921309/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "557972983/100000000",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "298307337/50000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "557215403/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "606842559/100000000",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "525749537/100000000",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "2625086/390625",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "124805517/20000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "656807791/100000000",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "615697899/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "615273269/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "602344759/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "581413053/100000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "617586727/100000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "7298832892991443/1298037220000000",
            "series": "OLS projection"
          },
          {
            "x": "18",
            "y": "21120943199016487/3245093050000000",
            "series": "OLS projection"
          },
          {
            "x": "1",
            "y": "644273855612069/162879100000000",
            "series": "IV moment line"
          },
          {
            "x": "18",
            "y": "582504445674069/81439550000000",
            "series": "IV moment line"
          }
        ],
        "plotFile": "econ23-fixed-results/realdata-person-python/plot.svg",
        "plotSHA256": "9c971ca1813b420c15c2d4fc6191c25415ff84997653a620274003198267ce9a",
        "files": [
          {
            "file": "econ23-fixed-results/realdata-person-python/full.json",
            "sha256": "aee10ae30160a78b40cf1eb79e57d277cee32452efc7ef35ea1e56ae225fdf85"
          },
          {
            "file": "econ23-fixed-results/realdata-person-python/plot-points.csv",
            "sha256": "c0987e0fa951c98c0c968c3c11fc9609f6fd8d2c3b7a888100db68e74cf18d8e"
          },
          {
            "file": "econ23-fixed-results/realdata-person-python/plot.svg",
            "sha256": "9c971ca1813b420c15c2d4fc6191c25415ff84997653a620274003198267ce9a"
          },
          {
            "file": "econ23-fixed-results/realdata-person-python/summary.csv",
            "sha256": "54206fe384b50c587d7762b8081e7f2955edad137518e9f388596a0bf2d621a0"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "company-paired": {
        "api": "realdata",
        "variant": "company-paired",
        "language": "python",
        "codeFile": "econ23-code/realdata-company-paired.py",
        "codeSHA256": "3ccdec6d9c5880cabf87c9627578b09225b4e6e3e57ad7f5f675a39642c16115",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='realdata'\nINPUT={'kind': 'company', 'options': {'frame': 'paired'}}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='realdata'\nINPUT={'kind': 'company', 'options': {'frame': 'paired'}}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "company",
          "options": {
            "frame": "paired"
          }
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=2.750000000, sensitivityAdjustedContrast=2.750000000, group0-commonUnits=75.000000000, group1-commonUnits=309.000000000\n",
        "stderr": "",
        "summary": {
          "differenceInDifferences": "2.750000000",
          "sensitivityAdjustedContrast": "2.750000000",
          "group0-commonUnits": "75.000000000",
          "group1-commonUnits": "309.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "1169/50",
            "series": "PA"
          },
          {
            "x": "1",
            "y": "6329/300",
            "series": "PA"
          },
          {
            "x": "0",
            "y": "42087/2060",
            "series": "NJ"
          },
          {
            "x": "1",
            "y": "25829/1236",
            "series": "NJ"
          }
        ],
        "plotFile": "econ23-fixed-results/realdata-company-paired-python/plot.svg",
        "plotSHA256": "2433a936a180a4d897ab38534aabdd4bb5ceb7664f0251d63a5960511f9fb15e",
        "files": [
          {
            "file": "econ23-fixed-results/realdata-company-paired-python/full.json",
            "sha256": "6d3e4a10a93a5eb34ce46814195528273c64fb7438e437a1a6ea8e6f1103b2f5"
          },
          {
            "file": "econ23-fixed-results/realdata-company-paired-python/plot-points.csv",
            "sha256": "353c922c77343080e0bd03dbd12903e66c7ae4031a76e107d310a454b0b2f3a2"
          },
          {
            "file": "econ23-fixed-results/realdata-company-paired-python/plot.svg",
            "sha256": "2433a936a180a4d897ab38534aabdd4bb5ceb7664f0251d63a5960511f9fb15e"
          },
          {
            "file": "econ23-fixed-results/realdata-company-paired-python/summary.csv",
            "sha256": "2570535aac12c2056741ec9bdd5db52349f5e25452dbb554be2b88abc24ccbfc"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "company-available": {
        "api": "realdata",
        "variant": "company-available",
        "language": "python",
        "codeFile": "econ23-code/realdata-company-available.py",
        "codeSHA256": "fefc5cd774878dc435ca61536d3326807adbc93b2b4f32bdc47da8a8d271ab95",
        "codeText": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='realdata'\nINPUT={'kind': 'company', 'options': {'frame': 'available'}}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "code": "\"\"\"ECON23 full-source reproduction with Python's standard-library Fraction.\n\npython econ23-public-analysis.py --source-dir econ23-sources --output-dir results\n\nRereads native-field CSVs, not a stored model or expected result. All sample\ncovariances use the common complete, positive-weight frame and divide by its\nweight sum. They are arithmetic moments, not unbiased variance estimates.\nThe program implements declared arithmetic, not causal-identification testing,\nrobust standard errors, weak-IV inference or a published controlled replication.\nMissing observed fields remain missing. Required/optional numeric None is never\nsilently changed to a default. Production parser/budget limits are separate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport argparse,csv,json,math\n\ndef q(value):\n if value is None:raise ValueError('explicit null is not a numeric parameter')\n return F(value)\ndef parse_rows(records,fields):\n if not records:raise ValueError('rows required')\n ids=set();out=[]\n for i,record in enumerate(records):\n  rid=str(record.get('id',i))\n  if not rid.strip() or rid in ids:raise ValueError('unique nonblank unit ID required')\n  ids.add(rid);w=q(record.get('weight',1))\n  if w<0:raise ValueError('negative weight')\n  out.append(dict(id=rid,weight=w,**{key:None if record[key] is None else q(record[key]) for key in fields}))\n return out\ndef mass(rows):return sum((r['weight'] for r in rows),F())\ndef mean(rows,key):\n W=mass(rows);return sum((r['weight']*r[key] for r in rows),F())/W if W else None\ndef divide(a,b):return a/b if a is not None and b is not None and b else None\ndef equilibrium(a):\n b=q(a['demandSlope']);d=q(a['supplySlope'])\n if min(b,d)<0:raise ValueError('nonnegative slope magnitudes')\n gamma=q(a.get('demandShifterSlope',1));delta=q(a.get('supplyShifterSlope',1));A=q(a['demandIntercept'])+gamma*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+delta*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0));den=b+d\n result=dict(demandEffectiveIntercept=A,supplyEffectiveIntercept=S,slopeSum=den)\n if not den:return dict(result,status='price-family-with-fixed-quantity' if A==S else 'no-equilibrium',price=None,quantity=A if A==S else None,nonnegativePriceQuantityFeasible=A==S and A>=0,derivatives=None)\n price=(A-S)/den;quantity=A-b*price;return dict(result,status='unique-unconstrained-equilibrium',price=price,quantity=quantity,demandSupplyResidual=quantity-S-d*price,nonnegativePriceQuantityFeasible=price>=0 and quantity>=0,derivatives=dict(priceDemandShifter=gamma/den,quantityDemandShifter=d*gamma/den,priceSupplyShifter=-delta/den,quantitySupplyShifter=b*delta/den))\ndef reduced_form(a):\n pi=q(a['firstStageSlope']);beta=q(a['causalSlope']);gamma=q(a.get('directInstrumentEffect',0));zz=q(a.get('varZ',1));vv=q(a.get('varV',1));uu=q(a.get('varU',1));zv=q(a.get('covZV',0));zu=q(a.get('covZU',0));vu=q(a.get('covVU',0));minors=[zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu];det=zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu)\n if min([zz,vv,uu,*minors,det])<0:raise ValueError('positive semidefinite covariance required')\n zx=pi*zz+zv;zy=beta*zx+gamma*zz+zu;xx=pi*pi*zz+vv+2*pi*zv;xu=pi*zu+vu;xy=beta*xx+gamma*zx+xu;yy=beta*beta*xx+gamma*gamma*zz+uu+2*beta*gamma*zx+2*beta*xu+2*gamma*zu;iv=divide(zy,zx)\n return dict(structuralReducedXSlope=pi,structuralReducedYSlope=beta*pi+gamma,projectionFirstStage=divide(zx,zz),projectionReducedForm=divide(zy,zz),ivRatio=iv,olsSlope=divide(xy,xx),causalSlopeStipulated=beta,ivMinusStipulatedSlope=None if iv is None else iv-beta,violationOverFirstStage=divide(gamma*zz+zu,zx),moments=dict(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=minors,covarianceDeterminant=det)\ndef selection(a):\n rr=parse_rows(a['rows'],['y0','y1'])\n for r,original in zip(rr,a['rows']):\n  if r['y0'] is None or r['y1'] is None:raise ValueError('both stipulated potential outcomes required')\n  D=int(original['D'])\n  if q(original['D'])!=D or D not in [0,1]:raise ValueError('binary treatment required')\n  r.update(D=D,effect=r['y1']-r['y0'])\n good=[r for r in rr if r['weight']>0];W=mass(good)\n if not W:raise ValueError('positive total weight required')\n treated=[r for r in good if r['D']==1];untreated=[r for r in good if r['D']==0];ATE=mean(good,'effect');ATT=mean(treated,'effect');ATU=mean(untreated,'effect');t0=mean(treated,'y0');t1=mean(treated,'y1');c0=mean(untreated,'y0');c1=mean(untreated,'y1');contrast=None if t1 is None or c0 is None else t1-c0;bias=None if t0 is None or c0 is None else t0-c0;share=mass(treated)/W\n return dict(sourceUnits=len(rr),positiveWeightUnits=len(good),treatedUnits=len(treated),untreatedUnits=len(untreated),treatedWeightShare=share,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=contrast,baselineSelectionBias=bias,selectionIdentityResidual=None if contrast is None else contrast-ATT-bias,weightedATEIdentityResidual=None if ATT is None or ATU is None else ATE-share*ATT-(1-share)*ATU)\ndef iv(a):\n data=parse_rows(a['rows'],['y','x','z']);complete=[r for r in data if r['weight']>0 and all(r[k] is not None for k in ['y','x','z'])];W=mass(complete);means={k:mean(complete,k) for k in ['y','x','z']}\n def moment(k,j):return sum((r['weight']*(r[k]-means[k])*(r[j]-means[j]) for r in complete),F())/W if W else None\n xx=moment('x','x');zz=moment('z','z');zx=moment('z','x');zy=moment('z','y');xy=moment('x','y');groups=None\n if complete and all(r['z'] in [0,1] for r in complete):groups=[dict(z=z,units=len(g),weight=mass(g),meanX=mean(g,'x'),meanY=mean(g,'y')) for z in [0,1] for g in [[r for r in complete if r['z']==z]]]\n return dict(sourceUnits=len(data),completePositiveWeightUnits=len(complete),missingOrZeroWeightUnits=len(data)-len(complete),completeWeight=W,means=means,moments=dict(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=divide(zx,zz),reducedFormProjection=divide(zy,zz),ivRatio=divide(zy,zx),olsProjection=divide(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=[r['id'] for r in complete])\ndef did(a):\n data=parse_rows(a['rows'],['before','after']);mode=a.get('frame','paired')\n if mode not in ['paired','available']:raise ValueError('paired or available frame required')\n drift=q(a.get('assumedUntreatedTrendDifference',0))\n for r,o in zip(data,a['rows']):\n  group=int(o['group'])\n  if q(o['group'])!=group or group not in [0,1]:raise ValueError('binary group required')\n  r['group']=group\n good=[r for r in data if r['weight']>0];groups=[]\n for group in [0,1]:\n  rr=[r for r in good if r['group']==group];common=[r for r in rr if r['before'] is not None and r['after'] is not None];basis=common if mode=='paired' else rr;b=[r for r in basis if r['before'] is not None];c=[r for r in basis if r['after'] is not None];before=mean(b,'before');after=mean(c,'after');groups.append(dict(group=group,sourceUnits=sum(r['group']==group for r in data),positiveWeightUnits=len(rr),beforeAvailableUnits=sum(r['before'] is not None for r in rr),afterAvailableUnits=sum(r['after'] is not None for r in rr),commonUnits=len(common),beforeMean=before,afterMean=after,beforeUsedUnits=len(b),afterUsedUnits=len(c),beforeUsedWeight=mass(b),afterUsedWeight=mass(c),change=None if before is None or after is None else after-before,commonIDs=[r['id'] for r in common]))\n contrast=None if any(g['change'] is None for g in groups) else groups[1]['change']-groups[0]['change'];return dict(sourceUnits=len(data),positiveWeightUnits=len(good),frame=mode,groups=groups,differenceInDifferences=contrast,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=None if contrast is None else contrast-drift)\ndef readcsv(file):\n with Path(file).open(encoding='utf-8-sig',newline='') as f:return list(csv.DictReader(f))\ndef read_sources(source):\n source=Path(source);raw=readcsv(source/'actual90-KOR-growth-and-CPI-original-1980-2024.csv');lookup={(int(r['year']),r['indicatorID']):r for r in raw};country=[]\n for year in range(1980,2025):\n  y=lookup[year,'NY.GDP.MKTP.KD.ZG'];x=lookup[year,'FP.CPI.TOTL.ZG'];country.append(dict(id='KOR:'+str(year),sourceRow=y['originalSourceRow']+'|'+x['originalSourceRow'],year=year,y=None if not y['valueToken'] else F(y['valueToken']),x=None if not x['valueToken'] else F(x['valueToken']),z=None if not x['valueToken'] else F(x['valueToken'])))\n person=[]\n for i,r in enumerate(readcsv(source/'actual3613-NLS-original52-fields.csv'),1):\n  vals={k:None if r[v]=='.' else F(r[v]) for k,v in [('y','lwage76'),('x','ed76'),('z','nearc4')]};person.append(dict(id='nls:'+str(i),sourceRow=str(i),originalID=r['id'],originalWeight=r['weight'],**vals))\n company=[]\n for i,r in enumerate(readcsv(source/'actual410-NJPA-original46-fields.csv'),1):\n  def fte(suffix):\n   v=[None if r[k+suffix]=='.' else F(r[k+suffix]) for k in ['EMPFT','NMGRS','EMPPT']];return None if None in v else v[0]+v[1]+v[2]/2\n  company.append(dict(id='store:'+str(i),sourceRow=str(i),originalSheet=r['SHEET'],group=int(r['STATE']),before=fte(''),after=fte('2'),status2=r['STATUS2'],chain=r['CHAIN']))\n return dict(country=country,person=person,company=company)\n_OMITTED_OPTIONS=object()\ndef realdata(models,kind,options=_OMITTED_OPTIONS):\n options={} if options is _OMITTED_OPTIONS else options\n if not isinstance(options,dict):raise ValueError('options object required')\n if kind=='country':\n  start=options.get('startYear',1980);end=options.get('endYear',2024)\n  if start is None or end is None or int(start)!=start or int(end)!=end or not 1980<=start<=end<=2024:raise ValueError('valid year range required')\n  return iv(dict(rows=[r for r in models[kind] if start<=r['year']<=end]))\n if kind=='person':return iv(dict(rows=models[kind]))\n if kind=='company':return did(dict(rows=models[kind],frame=options.get('frame','paired'),assumedUntreatedTrendDifference=options.get('assumedUntreatedTrendDifference',0)))\n raise ValueError('known actual case required')\ndef serial(x):\n if isinstance(x,F):return str(x)\n if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}\n if isinstance(x,(list,tuple)):return [serial(v) for v in x]\n return x\ndef writecsv(file,heads,rows):\n with Path(file).open('w',encoding='utf8',newline='') as f:\n  w=csv.writer(f);w.writerow(heads)\n  for r in rows:w.writerow(['' if v is None else str(v) for v in r])\nAPI='realdata'\nINPUT={'kind': 'company', 'options': {'frame': 'available'}}\n\ndef run_fixed(api,a,output,source):\n import matplotlib\n matplotlib.use('svg')\n import matplotlib.pyplot as plt\n from matplotlib.ticker import MaxNLocator\n plt.rcParams.update({'font.size':14,'svg.fonttype':'none','svg.hashsalt':'econ23-fixed-v1'})\n result=equilibrium(a) if api=='equilibrium' else reduced_form(a) if api=='reducedForm' else selection(a) if api=='selection' else iv(a) if api=='iv' else did(a) if api=='did' else realdata(read_sources(source),a['kind'],a.get('options',{}))\n output=Path(output);output.mkdir(parents=True,exist_ok=True);points=[];summary={};xlabel=ylabel=title=''\n def add(x,y,s):\n  if y is not None:points.append([x,y,s])\n if api=='equilibrium':\n  summary={k:result[k] for k in ['price','quantity']};A=q(a['demandIntercept'])+q(a.get('demandShifterSlope',1))*q(a.get('demandShifter',0))+q(a.get('demandShock',0));S=q(a['supplyIntercept'])+q(a.get('supplyShifterSlope',1))*q(a.get('supplyShifter',0))+q(a.get('supplyShock',0))\n  for p in range(0,41,5):add(p,A-q(a['demandSlope'])*p,'Demand');add(p,S+q(a['supplySlope'])*p,'Supply')\n  xlabel,ylabel,title='Price (assumed units)','Quantity (assumed units)','Stipulated market schedules'\n elif api=='reducedForm':\n  summary={k:result[k] for k in ['projectionFirstStage','projectionReducedForm','ivRatio','olsSlope']}\n  for z in range(-2,3):add(z,result['structuralReducedYSlope']*z,'Structural path V=U=0')\n  xlabel,ylabel,title='Instrument Z (assumed)','Outcome Y (assumed)','Stipulated path, not sampled observations'\n elif api=='selection':\n  summary={k:result[k] for k in ['ATE','ATT','ATU','observedDifference']}\n  for i,r in enumerate(a['rows']):add(i+1,q(r['y1'])-q(r['y0']),'Stipulated unit effect')\n  xlabel,ylabel,title='Unit A=1, B=2','Potential-outcome difference','Both potential outcomes are stipulated'\n elif api in ['iv','realdata'] and a.get('kind')!='company':\n  rows=a['rows'] if api=='iv' else read_sources(source)[a['kind']];good=[r for r in rows if all(r[k] is not None for k in ['x','y','z']) and q(r.get('weight',1))>0];summary={k:result[k] for k in ['completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection']}\n  for r in good:add(q(r['x']),q(r['y']),'Observed')\n  if good:\n   for key,label in [('olsProjection','OLS projection'),('ivRatio','IV moment line')]:\n    b=result[key]\n    if b is not None:\n     alpha=result['means']['y']-b*result['means']['x']\n     for x in [min(q(r['x']) for r in good),max(q(r['x']) for r in good)]:add(x,alpha+b*x,label)\n  country=api=='realdata' and a['kind']=='country';person=api=='realdata' and a['kind']=='person'\n  xlabel='CPI inflation (%)' if country else 'Schooling (years)' if person else 'Observed X';ylabel='Real GDP growth (%)' if country else 'Log wage (cents/hour)' if person else 'Observed Y';title='Recorded sample; lines are not causal certification'\n else:\n  summary={k:result[k] for k in ['differenceInDifferences','sensitivityAdjustedContrast']}\n  for g in result['groups']:\n   summary['group'+str(g['group'])+'-commonUnits']=g['commonUnits']\n   for x,key in enumerate(['beforeMean','afterMean']):add(x,g[key],('PA' if g['group']==0 else 'NJ') if api=='realdata' else 'Group '+str(g['group']))\n  xlabel='Wave (0=before, 1=after)';ylabel='FTE persons' if api=='realdata' else 'Outcome (assumed units)';title='Group means: '+a.get('options',a).get('frame','paired')+' frame'\n def display(v):return 'undefined' if v is None else format(float(v),'.9f')\n writecsv(output/'summary.csv',['metric','value'],[[k,display(v)]for k,v in summary.items()]);writecsv(output/'plot-points.csv',['x','y','series'],points);(output/'full.json').write_text(json.dumps(serial(result),indent=2)+'\\n',encoding='utf8')\n fig,ax=plt.subplots(figsize=(5.6,4.6));fig.subplots_adjust(left=.23,right=.96,bottom=.22,top=.81)\n colors=['#355c72','#a55336','#507956']\n for i,s in enumerate(dict.fromkeys(p[2] for p in points)):\n  pp=[p for p in points if p[2]==s];xs=[float(p[0])for p in pp];ys=[float(p[1])for p in pp]\n  if s in ['Observed','Stipulated unit effect']:ax.scatter(xs,ys,s=10 if s=='Observed' else 35,alpha=.45 if s=='Observed' else 1,color=colors[i%3],label=s)\n  else:ax.plot(xs,ys,marker='o' if len(xs)<=2 else None,linewidth=1.6,color=colors[i%3],label=s)\n ax.set_xlabel(xlabel,labelpad=10);ax.set_ylabel(ylabel,labelpad=10);ax.xaxis.set_major_locator(MaxNLocator(3));ax.yaxis.set_major_locator(MaxNLocator(4));ax.grid(alpha=.18);ax.legend(loc='lower left',bbox_to_anchor=(0,1.02),fontsize=10,frameon=False,ncol=1);fig.suptitle(title,fontsize=10,y=.99)\n fig.savefig(output/'plot.svg',metadata={'Date':None});plt.close(fig)\n print(', '.join(k+'='+display(v) for k,v in summary.items()))\nif __name__=='__main__':\n import sys\n try:run_fixed(API,INPUT,sys.argv[1] if len(sys.argv)>1 else 'fixed-results',sys.argv[2] if len(sys.argv)>2 else 'econ23-sources')\n except ValueError as error:print('Rejected declared input: '+str(error),file=sys.stderr);sys.exit(2)\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "company",
          "options": {
            "frame": "available"
          }
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=2.753605783, sensitivityAdjustedContrast=2.753605783, group0-commonUnits=75.000000000, group1-commonUnits=309.000000000\n",
        "stderr": "",
        "summary": {
          "differenceInDifferences": "2.753605783",
          "sensitivityAdjustedContrast": "2.753605783",
          "group0-commonUnits": "75.000000000",
          "group1-commonUnits": "309.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "3593/154",
            "series": "PA"
          },
          {
            "x": "1",
            "y": "6519/308",
            "series": "PA"
          },
          {
            "x": "0",
            "y": "131221/6420",
            "series": "NJ"
          },
          {
            "x": "1",
            "y": "26831/1276",
            "series": "NJ"
          }
        ],
        "plotFile": "econ23-fixed-results/realdata-company-available-python/plot.svg",
        "plotSHA256": "84082a38a35ab13e7cf22e91fb9e63aa719be663d65cd37d91e18d6a232f8a04",
        "files": [
          {
            "file": "econ23-fixed-results/realdata-company-available-python/full.json",
            "sha256": "38da353d6a72ff39512293a8119a9a12eb142eb8ebf95cc20bde4791b705db0c"
          },
          {
            "file": "econ23-fixed-results/realdata-company-available-python/plot-points.csv",
            "sha256": "0c95d5562b6b2d87d816434ceeed207390853463133d3f7b83832b51a0e6cf68"
          },
          {
            "file": "econ23-fixed-results/realdata-company-available-python/plot.svg",
            "sha256": "84082a38a35ab13e7cf22e91fb9e63aa719be663d65cd37d91e18d6a232f8a04"
          },
          {
            "file": "econ23-fixed-results/realdata-company-available-python/summary.csv",
            "sha256": "c268287ae00203c0aee4c66b72fa14602c191d5dba13d36e955a43a375d7cfdd"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    },
    "r": {
      "country": {
        "api": "realdata",
        "variant": "country",
        "language": "r",
        "codeFile": "econ23-code/realdata-country.R",
        "codeSHA256": "13d001a0a963045d215921f150c9c6c199f55a7f449b6724d01fdd780d41e7ec",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"realdata\"\r\nINPUT<-list(kind=\"country\")\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"realdata\"\r\nINPUT<-list(kind=\"country\")\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "country"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=45.000000000, firstStageProjection=1.000000000, ivRatio=-0.051694510, olsProjection=-0.051694510 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "completePositiveWeightUnits": "45.000000000",
          "firstStageProjection": "1.000000000",
          "ivRatio": "-0.051694510",
          "olsProjection": "-0.051694510"
        },
        "plotPoints": [
          {
            "x": "28.6976086362016",
            "y": "-1.52426391001066",
            "series": "Observed"
          },
          {
            "x": "21.351640254",
            "y": "7.40382133739918",
            "series": "Observed"
          },
          {
            "x": "7.19084664006869",
            "y": "8.46826958565821",
            "series": "Observed"
          },
          {
            "x": "3.42061419498921",
            "y": "13.4668057465528",
            "series": "Observed"
          },
          {
            "x": "2.27395640001863",
            "y": "10.6366054976723",
            "series": "Observed"
          },
          {
            "x": "2.45910879215274",
            "y": "7.93879547760545",
            "series": "Observed"
          },
          {
            "x": "2.74998096063357",
            "y": "11.50298504807",
            "series": "Observed"
          },
          {
            "x": "3.04966077087423",
            "y": "12.8922089918574",
            "series": "Observed"
          },
          {
            "x": "7.14609773721605",
            "y": "12.1331951107172",
            "series": "Observed"
          },
          {
            "x": "5.700165445614",
            "y": "7.16501737923842",
            "series": "Observed"
          },
          {
            "x": "8.57327225728676",
            "y": "10.0248996213899",
            "series": "Observed"
          },
          {
            "x": "9.33279048161495",
            "y": "10.8749739277708",
            "series": "Observed"
          },
          {
            "x": "6.21328146355184",
            "y": "6.35159199606441",
            "series": "Observed"
          },
          {
            "x": "4.80099660215353",
            "y": "6.99471791742556",
            "series": "Observed"
          },
          {
            "x": "6.26585950039679",
            "y": "9.3718357757101",
            "series": "Observed"
          },
          {
            "x": "4.48074108557248",
            "y": "9.7358937505409",
            "series": "Observed"
          },
          {
            "x": "4.92454354292753",
            "y": "7.99042982526839",
            "series": "Observed"
          },
          {
            "x": "4.4389318457463",
            "y": "6.2821926537929",
            "series": "Observed"
          },
          {
            "x": "7.51358008079306",
            "y": "-4.9389297463141",
            "series": "Observed"
          },
          {
            "x": "0.812957254446369",
            "y": "11.6172629559591",
            "series": "Observed"
          },
          {
            "x": "2.25916580080157",
            "y": "9.2018583880479",
            "series": "Observed"
          },
          {
            "x": "4.06657587897792",
            "y": "4.72593560322356",
            "series": "Observed"
          },
          {
            "x": "2.76226210296599",
            "y": "7.74399895319569",
            "series": "Observed"
          },
          {
            "x": "3.51487451459939",
            "y": "3.07472661826947",
            "series": "Observed"
          },
          {
            "x": "3.59066298882577",
            "y": "5.1836368597334",
            "series": "Observed"
          },
          {
            "x": "2.75379162735039",
            "y": "4.35823667337156",
            "series": "Observed"
          },
          {
            "x": "2.2423402851892",
            "y": "5.24500550580342",
            "series": "Observed"
          },
          {
            "x": "2.53457382137932",
            "y": "5.8419633918717",
            "series": "Observed"
          },
          {
            "x": "4.67389655533408",
            "y": "3.00440451679569",
            "series": "Observed"
          },
          {
            "x": "2.75649654493929",
            "y": "0.81986175641795",
            "series": "Observed"
          },
          {
            "x": "2.93928652655685",
            "y": "6.98166138853071",
            "series": "Observed"
          },
          {
            "x": "4.0259650043609",
            "y": "3.6880320602952",
            "series": "Observed"
          },
          {
            "x": "2.18707104433313",
            "y": "2.54766550568242",
            "series": "Observed"
          },
          {
            "x": "1.30134754547412",
            "y": "3.2913959543442",
            "series": "Observed"
          },
          {
            "x": "1.27477446401321",
            "y": "3.21468019683108",
            "series": "Observed"
          },
          {
            "x": "0.706331772455749",
            "y": "2.92029267301234",
            "series": "Observed"
          },
          {
            "x": "0.971685739912167",
            "y": "3.17152748983935",
            "series": "Observed"
          },
          {
            "x": "1.94433230786366",
            "y": "3.433191763972",
            "series": "Observed"
          },
          {
            "x": "1.47583935002645",
            "y": "3.17611568177327",
            "series": "Observed"
          },
          {
            "x": "0.383000303608135",
            "y": "2.31380210595475",
            "series": "Observed"
          },
          {
            "x": "0.537288023411737",
            "y": "-0.700242317542106",
            "series": "Observed"
          },
          {
            "x": "2.49833333333339",
            "y": "4.61296795454287",
            "series": "Observed"
          },
          {
            "x": "5.08951365062841",
            "y": "2.72756456708991",
            "series": "Observed"
          },
          {
            "x": "3.5974562502901",
            "y": "1.58301467403629",
            "series": "Observed"
          },
          {
            "x": "2.32174328643542",
            "y": "2.00361101838986",
            "series": "Observed"
          },
          {
            "x": "0.383000303608135",
            "y": "5.9599527682584",
            "series": "OLS projection"
          },
          {
            "x": "28.6976086362016",
            "y": "4.49624295302659",
            "series": "OLS projection"
          },
          {
            "x": "0.383000303608135",
            "y": "5.9599527682584",
            "series": "IV moment line"
          },
          {
            "x": "28.6976086362016",
            "y": "4.49624295302659",
            "series": "IV moment line"
          }
        ],
        "plotFile": "econ23-peer-display-corrected/realdata-country-r/plot.svg",
        "plotSHA256": "99d266fc94e07ddc3c9b91a4f71e2e91b516f154befa12c80527d1b12c3b93ba",
        "files": [
          {
            "file": "econ23-peer-display-corrected/realdata-country-r/full-result.Rtext",
            "sha256": "79d4426f5a2b3463a791b268234a8a060420576d2b02f2794bad49da285b9f1b"
          },
          {
            "file": "econ23-peer-display-corrected/realdata-country-r/plot-points.csv",
            "sha256": "9fd80dbf0608432bc0711d91634f28481c1b1f20e0b4982f666bcb3ed798c515"
          },
          {
            "file": "econ23-peer-display-corrected/realdata-country-r/plot.svg",
            "sha256": "99d266fc94e07ddc3c9b91a4f71e2e91b516f154befa12c80527d1b12c3b93ba"
          },
          {
            "file": "econ23-peer-display-corrected/realdata-country-r/summary.csv",
            "sha256": "022294312bfd53303e22c5fd9fada6ac850df3db97e94b4124720b04cb4927a5"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "person": {
        "api": "realdata",
        "variant": "person",
        "language": "r",
        "codeFile": "econ23-code/realdata-person.R",
        "codeSHA256": "ee0f052874078ea399d8f182deb41aa69e1ef66768ca6839211f67b206876e46",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"realdata\"\r\nINPUT<-list(kind=\"person\")\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\r\n# Rscript econ23-public-analysis.R econ23-sources results-r\r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\r\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\r\n# sample arithmetic, not causal identification, robust standard errors, or a\r\n# replication of the original papers' controlled estimates. Explicit NULL\r\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\r\noptions(stringsAsFactors=FALSE,digits=17)\r\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\r\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\r\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\r\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\r\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\r\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\r\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\r\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\r\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\r\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\r\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\r\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\r\nAPI<-\"realdata\"\r\nINPUT<-list(kind=\"person\")\r\n\r\nrun_fixed<-function(api,a,out,src){\r\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\r\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\r\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\r\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\r\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\r\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\r\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\r\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\r\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\r\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=ifelse(ss=='Observed',NA,1),pch=ifelse(ss=='Observed',16,NA),cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\r\n}\r\nargs<-commandArgs(trailingOnly=TRUE)\r\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\r\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "person"
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "completePositiveWeightUnits=3010.000000000, firstStageProjection=0.829018980, ivRatio=0.188062635, olsProjection=0.052094237 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "completePositiveWeightUnits": "3010.000000000",
          "firstStageProjection": "0.829018980",
          "ivRatio": "0.188062635",
          "olsProjection": "0.052094237"
        },
        "plotPoints": [
          {
            "x": "7",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.59167373",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.33682573",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.41017488",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2441669",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.37989735",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.79570578",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.48920493",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.85012617",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.41999493",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.4035742",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.24422752",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.49554194",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.44888939",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.33753808",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.12468339",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.71417053",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.54126355",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.85012617",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.0440329",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.78074352",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.45958551",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.43615037",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.84064166",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.86646806",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.49072353",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.43133108",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.60394382",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.6347896",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.07304453",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.5581978",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34738921",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.60665019",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.38350663",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.36129217",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.35436233",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.65157187",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.34563636",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.44094654",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30078579",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35610766",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.66949809",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.91968385",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.63068339",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.6454469",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.04141166",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.69703425",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.59441346",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.37672695",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.3082677",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.70441435",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.42810527",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23832463",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.01301579",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.05098945",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.7178047",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.82762923",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.98100574",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.80239476",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.52502966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01859321",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.91274282",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.58617165",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.8793558",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.15697899",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.82008293",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.94803499",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.5539334",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.14418563",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.82871207",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.67582322",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34563636",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.5581978",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54247196",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.60258789",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.24422752",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.48310735",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.57972983",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.38687932",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.14203741",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.65248918",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.72262979",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.00306546",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.63725803",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.67834211",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.01371516",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.78897174",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35610766",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.41836494",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.24222327",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.12468339",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.85751406",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.01660968",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.66642669",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.1428274",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.41836494",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30078579",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.62762111",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.27378632",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.90274274",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.7546041",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53087763",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.72383244",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.45047042",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53524127",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.52502966",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.50727771",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.93342303",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.66988092",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.05098945",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.30809844",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "7.15617664",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.37672695",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.14632926",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.83410874",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.32076829",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.96357934",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.67834211",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.15485809",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.3082677",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.16541785",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4.91265489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.7365723",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.18690102",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.31173481",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.78105763",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.63331843",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56244409",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35610766",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27476202",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.64639051",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.96870756",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.69703425",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.29710932",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.3851944",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.76157277",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23441073",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.63463336",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.20050917",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.09807428",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.41017488",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70073111",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78689738",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.70318811",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.02553831",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.57228254",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.38181602",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.09582456",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.19031541",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.54391185",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.32076829",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.50428817",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.7848893",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.63068339",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.89365635",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.65599181",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.44241771",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.57088296",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.55250789",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.76619171",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.82110747",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.97073008",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46146818",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.65248918",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.96357934",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.91770561",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.88243747",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.13772705",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.23489842",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99396143",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.768321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.24222327",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.33753808",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.08338785",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.57088296",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.315358",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.36130248",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.73459166",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.56164175",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.69208374",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.84064166",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.72982407",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.33327963",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.25134498",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1737861",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.75227038",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.60394382",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.96413561",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.34913899",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.69084228",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.60665019",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.93753621",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.54247196",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.92165818",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.0352686",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.44366368",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.91770561",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.74051936",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.56526497",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70930434",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10255859",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.95559261",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.09174212",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.5366916",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.4738907",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "7.71601527",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.27378632",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.768321",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.14045304",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.61204103",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.74051936",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70073111",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.32972091",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.65248918",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.0799332",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.3630281",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.37672695",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.74300319",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.83773045",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.31896811",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.54965074",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.56164175",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.10332206",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.61338422",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.12686918",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.47234629",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.61338422",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70318811",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.48768402",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.74641213",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.49677499",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.79009724",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.44241771",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68710861",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.27852142",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.65286303",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.16541785",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.92165818",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.32076829",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.26909628",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.05098945",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.75110147",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1717006",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.89669433",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.10255859",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.90975328",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.12367279",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.82546004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34738921",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.05098945",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1737861",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.73221071",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.24565507",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56526497",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.96100534",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53378884",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.44571982",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.95081477",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66057515",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.49072353",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.91770561",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05443935",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.96602419",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.02586597",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.19847872",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.67332327",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.59441346",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.19031541",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.82008293",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58617165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.82979374",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.24222327",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.97073008",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.45833828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.60529792",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.20050917",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.44413126",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.01371516",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.61338422",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30809844",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.78689738",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.55295958",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.45990445",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.22257627",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.91770561",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66568372",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30261898",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.71901315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.0689042",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.7170277",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.315358",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.23244802",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.27378632",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.7787849",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.76041469",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.60665019",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.79009724",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.12686918",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.61204103",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.79009724",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.4035742",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.6147256",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.32793678",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.04973346",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.4707995",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39359075",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26909628",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.74523635",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.22653667",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23832463",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.0369526",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.32256524",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.91889385",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.36990098",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.2441669",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.96614674",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.6347896",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.5366916",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.83481074",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.87493073",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.5683445",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.60665019",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.83481074",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.62040087",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.47646355",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.3952616",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4.99043259",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.6347896",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.91770561",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.24804287",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39024067",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.8230459",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.72031178",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.93224519",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56244409",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.01859321",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "7.19967835",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.57368017",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.25749537",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.68085468",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.82871207",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.93244789",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22059017",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.16541785",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.49677499",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.56103067",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.83303173",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46925032",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.93342303",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.33823815",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.82762923",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.34212142",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.01750614",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.56807791",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.82979374",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.60211882",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.72503364",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.09007684",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.36475076",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.53087763",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.28599809",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.5366916",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51767127",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.15909539",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.42971948",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.9348942",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.49306144",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.08904488",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.53378884",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.2166061",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.88857246",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.56103067",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.94985646",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.63463336",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56948142",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.49526556",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.29710932",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46146818",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.69373214",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.85329909",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.42971948",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.62401751",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.58892648",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.14203741",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.56526497",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.72503364",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.27378632",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.20489251",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.24997524",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.12249281",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.01371516",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.32614947",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.93342303",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.98656646",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.09174212",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.79605775",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.42833319",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.15617664",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.09582456",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.14632926",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "6.50428817",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.65599181",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.65286303",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.96129605",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51619308",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53813982",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.27378632",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.20253552",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.57507584",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46614472",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.52062113",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28039584",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.91350301",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.48920493",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.73979291",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.73459166",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.49223984",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.5581978",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.6767538",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.27378632",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.09174212",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "7.37963215",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.69084228",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.98645201",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.75110147",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.84354442",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.32972091",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.52795792",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.15060277",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.58892648",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62671775",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46146818",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.26192709",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.63463336",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.01301579",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.63725803",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.05185562",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.31896811",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.29710932",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.76157277",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.41836494",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.25190388",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.56103067",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.70686234",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.5539334",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.18690102",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.21060008",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.49677499",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.94119006",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.98378997",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42971948",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.96413561",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30078579",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.66695679",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.18414889",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.58202514",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.54391185",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.30809844",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.67582322",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.56164175",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.67582322",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.80239476",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.48310735",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.95064255",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.14203657",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.61606519",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51025834",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.89060912",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.09174212",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.7310181",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.09582456",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.29710932",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68085468",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.87773578",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "4.76217393",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.28413416",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.27664349",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.0591232",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.99759598",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.56268125",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.74523635",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.16120732",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.48616079",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.04751722",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.81114099",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.5539334",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.77308038",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.46146818",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.00397414",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.82871207",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.5482191",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.32076829",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37161185",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66057515",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48616079",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.15617664",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.47234629",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.84374995",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.28599809",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.66988092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.25749537",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.70686234",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.70073111",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58892648",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.02553831",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99893656",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.5581978",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.82008293",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.72503364",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.25749537",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.59304453",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.7129562",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.5998705",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.82894562",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.29710932",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.10255859",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.37989735",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.86363118",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.91572345",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.48310735",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.68835471",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34563636",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46925032",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.09807428",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.38012254",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.31716469",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.56948142",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.60665019",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51767127",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.68085468",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.25190388",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.97380961",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.8145429",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07764224",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26530121",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.420535",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.56667243",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66822825",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.12029742",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.62401751",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43615037",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54678541",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.9348942",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.15909539",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.19644413",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.82871207",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.06145692",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.91350301",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.22653667",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42810527",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.94279938",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37672695",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.18208491",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.72743172",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.19644413",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.81783057",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.72262979",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07304453",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.44241771",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.97888576",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.07918439",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2166061",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.81711116",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.33682573",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.87109129",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.22548147",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.41181827",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.50727771",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.09807428",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.18414889",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.56526497",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.8596149",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.1737861",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.12468339",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.5971457",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.79909265",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01615716",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.18620862",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.88332239",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.79909265",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.20455776",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48157713",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58202514",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55677836",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.24222327",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.43294009",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48157713",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46614472",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.49828215",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.31896811",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.4645883",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.18538702",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22257627",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.66057515",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.52795792",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.44254017",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.31716469",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.4035742",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.40687999",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.92853782",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.57088296",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.36818719",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55961524",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.48616079",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.52795792",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.62040087",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.56103067",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66949809",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.18462915",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58202514",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.63331843",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.07304453",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "7.08338785",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.91350301",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07534603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.80513497",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46146818",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58202514",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.49828215",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.79905586",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.67582322",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.28971557",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.79905586",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.82979374",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23048145",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.83410874",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.5581978",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.58349631",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.84587988",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64118217",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.56103067",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.52795792",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.52502966",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.82219739",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.60394382",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.06219163",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.63987583",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.48920493",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.39024067",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.81234509",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.95559261",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.12029742",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.82979374",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.33327963",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.22983878",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66949809",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.96357934",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.87211779",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70318811",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07534603",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.32787617",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.18414889",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.63200178",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.90274274",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.06219163",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.74939299",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.81892407",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.49828215",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.6631327",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.58724866",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.87211779",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.33327963",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66695679",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.09174212",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01615716",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.91350301",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.67076632",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.13169851",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "4.85203026",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.98141421",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.44571982",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.18414889",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30809844",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.91889385",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.25190388",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.59441346",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.42324696",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.15485809",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.06378521",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.58724866",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.06842559",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27476202",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.00306546",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37672695",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.73459166",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.82546004",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.42648846",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01859321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.73979291",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.49306144",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.51342875",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53813982",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.10702289",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.13089883",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.19440539",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37331979",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.78689738",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.06378521",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34738921",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.41181827",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.56948142",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56526497",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.03548143",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.41345896",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.6424868",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42971948",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.24610677",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.4645883",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.25190388",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34212142",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.88550967",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.65801105",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.09356977",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.65027905",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.80239476",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.18414889",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.79570578",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.96129605",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.8384052",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34212142",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.89467004",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.4738907",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.10702289",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.3630281",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.07517382",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.76388491",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.52649486",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.01660968",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.00306546",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.65599181",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.94601399",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.7365723",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.81413053",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.24997524",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.56385553",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43454652",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.69709349",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.12905021",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.98141421",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.38687932",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.94601399",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.5482191",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.56948142",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.96413561",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.38012254",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.45047042",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.66949809",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.72383244",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28971557",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.58202514",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.11368218",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.97380961",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.89669433",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.77992191",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.80793494",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.87493073",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.62762111",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.6094718",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.4019172",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.00306546",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.82008293",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.62936325",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.31716469",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.06842559",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.68085468",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.69332367",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.8384052",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43454652",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.79301361",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.82762923",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.29156914",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.12905021",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.18414889",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.22257627",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89440283",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.48310735",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.50125821",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.7787849",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53233429",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.99645209",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.0591232",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.58617165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.65929392",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.5759491",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.88755257",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.84064166",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.33327963",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.13772705",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.33682573",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.45833828",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.50727771",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.92157842",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.32435896",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.32435896",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.79909265",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.75576892",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.47227067",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.87773578",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17794411",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.86171134",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.66988092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.72022016",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.39359075",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.42971948",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.1484683",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.63331843",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.32793678",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01859321",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.18738581",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.1685799",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.16541785",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.65286303",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.57088296",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.06145692",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.07534603",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.04973346",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.19236249",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.82894562",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.36475076",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2441669",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.95939851",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.31455283",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.80211838",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.98393628",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.74051936",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.63200178",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.93731408",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.77536609",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34212142",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.27852142",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.4035742",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48768402",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.6347896",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.70686234",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.43615037",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.4035742",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.51323011",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.7787849",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.67456139",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.78996017",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.66695679",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.82008293",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.06145692",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.8916259",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.61338422",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.84354442",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.31716469",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.57215403",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.61338422",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30078579",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43615037",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70073111",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.18414889",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.73459166",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.16751649",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.2441669",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.54517744",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.57646957",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.67959919",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.03787092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.06610809",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.52941884",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.31173481",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56103067",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.25958146",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.98393628",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.77078942",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.9348942",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89715387",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.29156914",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.88610403",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "5.84354442",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.95844839",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.29710932",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.09174212",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.63835467",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4.84418709",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.23921497",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.04025471",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.12029742",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.49375384",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.11368218",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.2126061",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.14203741",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.90808294",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.12468339",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.66642669",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.41164605",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.89440283",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.433722",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.45532112",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.14203741",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.64156444",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51914729",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.5539334",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.87211779",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.25190388",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.88332239",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.85507192",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.68017261",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.09356977",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.59842196",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.39024067",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27476202",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.38181602",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22059017",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.22548147",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.5539334",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.09582456",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.32793678",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.7365723",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.14598447",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.36818719",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "4.71849887",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.56164175",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.50125821",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "7.05098945",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.46622756",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.59304453",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.60123012",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.6454469",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.02827852",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.25766759",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55961524",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.01371516",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.03068526",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.66695679",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.16961073",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.65948222",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.54126355",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26149168",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.6767538",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.81234509",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.86646806",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.05185562",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.66057515",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.03068526",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.89715387",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.88053299",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.26909628",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70044357",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.29156914",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.26909628",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.28826703",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62406523",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.09807428",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "5.11799381",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.09807428",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.98645201",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.25958146",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.59842196",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.7365723",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.80239476",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.65248918",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.62762111",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.97126184",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23636959",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43615037",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.49716823",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89440283",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.40687999",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.63331843",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.20455776",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.71901315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.58724866",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.70711026",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48920493",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.24222327",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.72031178",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.06378521",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "4.60517019",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.23644196",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.87211779",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.58724866",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.58724866",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37331979",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.30078579",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.33150185",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.79122146",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.03068526",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "6.52649486",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.7365723",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.49828215",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.65599181",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.60934924",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43454652",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.4019172",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.79909265",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.52795792",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.99484999",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.16541785",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.85646198",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.04053639",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10479323",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.42324696",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.19440539",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.02827852",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.05185562",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.32435896",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.86078622",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58340922",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.34388043",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.8230459",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.66296048",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.74288064",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.77308038",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.68697536",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.66642669",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.69709349",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.00033446",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.14203741",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.57972983",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.73221071",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.45958551",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.27811466",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.81114099",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.1180972",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.85118493",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.67332327",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.16120732",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.69035945",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.04025471",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.25190388",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.75574221",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.85012617",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.97380961",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.19847872",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.59098698",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.63835467",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.57215403",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.91968385",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.72503364",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.7651911",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.03548143",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26720055",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.25190388",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.81413053",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.75110147",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.75574221",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.72262979",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.22548147",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.11146734",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.52795792",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.07534603",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.75110147",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.54517744",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.08904488",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.00388707",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01615716",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.91968385",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.11368218",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.96100534",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.19847872",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48463524",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.56385553",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.23636959",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.02586597",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.15485809",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.19440539",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.61338422",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.768321",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.40687999",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.33327963",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.71052311",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.69703425",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.9242558",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42810527",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37161185",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37502482",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27852142",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.48463524",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.42486902",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.40025745",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.53087763",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.03043792",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.38856141",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.7170277",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.64190707",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.56667243",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.86589107",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.09582456",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.45958551",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52942909",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.96614674",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.66296048",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.88610403",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.97380961",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.23644196",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.65248918",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.64639051",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.32435896",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.47477218",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54391185",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.19236249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23244802",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70686234",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.228511",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.40687999",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70073111",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.65248918",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.97354302",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.39939808",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.75693239",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.62804138",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.00850518",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.67332327",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.80513497",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.25382881",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.01063529",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.79570578",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.77765232",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.48479693",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.63068339",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.59034695",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54391185",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.19644413",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.33682573",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.82894562",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.69709349",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "7.00033446",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.40687999",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.37842618",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.96614674",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.09356977",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.56103067",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.65672652",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23441073",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.09130988",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.15070146",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.00388707",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.6347896",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.60240134",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.76388491",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.77992191",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.41345896",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4.99721227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.71417053",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.2441669",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.56807791",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.73933663",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.78558765",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.74641213",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.60394382",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.67834211",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.36130248",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.76734313",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.23345542",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.37963215",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.49677499",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.73933663",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48768402",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "7.09007684",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.64639051",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.83773045",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.65681009",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.93634274",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56948142",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.38856141",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.72503364",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.11799381",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.14632926",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.46614472",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.50128967",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.315358",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.66568372",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.50279005",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.54678541",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.52941884",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.02586597",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62140565",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.44241771",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.17701877",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.96413561",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.44094654",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.95654544",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.89060912",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.15617664",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.70686234",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.57925121",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.84374995",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.66057515",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.90374726",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.36647045",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.44241771",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.28971557",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.44254017",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51323011",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.44241771",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.57368017",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.65599181",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.74300319",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.00850518",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.36818719",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.42648846",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.62401751",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.53958596",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.33327963",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "7.19743535",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.75227038",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43935037",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.27447956",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.81711116",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.1737861",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.1717006",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.94505106",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.99393298",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.768321",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.84932478",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.7580945",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.64190707",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54965074",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.28039584",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.73696696",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.315358",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.92165818",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.64768837",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.8145429",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.61338422",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51323011",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.64639051",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.58892648",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.50128967",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.53378884",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.32793678",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.50727771",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58755001",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "7.05098945",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.04500531",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.96885038",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.06902343",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.74758653",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.41345896",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.09007684",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.93634274",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.29710932",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.75110147",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.59030105",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.93244789",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "7.05098945",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.89060912",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.58892648",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27664349",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.66642669",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.00306546",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.49223984",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.57215403",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.54126355",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.50727771",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.95559261",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "7.52077642",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.53378884",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.1717006",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.83188248",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.80903931",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.86078622",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.65286303",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.38350663",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.60665019",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.27852142",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.23993259",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.48768402",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.34913899",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43615037",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.09130988",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.29156914",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.73459166",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.58479139",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.32256524",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.81114099",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.23441073",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23636959",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.73979291",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.50727771",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.44730586",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.50128967",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.47234629",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.84354442",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.73340189",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.82328612",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.59304453",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10479323",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.18001665",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01859321",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.78558765",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.5971457",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.12905021",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.54965074",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.66568372",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.82979374",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.10702289",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.52649486",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.25766759",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.29341928",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.74758653",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.3044488",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.97354302",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.60529792",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "7.2984451",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.80239476",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.29156914",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.67203295",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.3403593",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.87493073",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.27476202",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "4.9698133",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.18620862",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.39359075",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.69950034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.94985646",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.68461173",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.69950034",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.62140565",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.68357977",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05678401",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.64897424",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1737861",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.9348942",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.23048145",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58340922",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "7.09174212",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.33327963",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.57786136",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.98656646",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.62140565",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.87493073",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99396143",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.65948222",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.73334128",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.35957387",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.15329159",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17794411",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.72503364",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.63121178",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "4.97673374",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.70563909",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.01126717",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.26530121",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35957387",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.42971948",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.3630281",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.05185562",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.42324696",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56948142",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.77765232",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.94505106",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.19644413",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.96100534",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.60258789",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.3952616",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.03085748",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.39859493",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.69709349",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.45958551",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.54678541",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.66988092",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.50938834",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.48616079",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56667243",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39024067",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.35957387",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.51914729",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.33823815",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.75693239",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.28039584",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.73009978",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.29156914",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.84064166",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.768321",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.9348942",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.23644196",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.12396398",
            "series": "Observed"
          },
          {
            "x": "2",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "3",
            "y": "5.24702407",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.90775528",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.33505425",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.43615037",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.57088296",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.87211779",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.48063892",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.03548143",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.93342303",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.68697536",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28785856",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56667243",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.433722",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.7365723",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.768321",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.71373281",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.62406523",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.74051936",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.1717006",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.06145692",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.19440539",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.73979291",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.60211882",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.94279938",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.14203741",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.12029742",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.5581978",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.66296048",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.06145692",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.27476202",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08677473",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.12468339",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.04737218",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.04025471",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.57088296",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.98645201",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.98645201",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.59850903",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53378884",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.35658627",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.12029742",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.54965074",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89715387",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43133108",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.83188248",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.19236249",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.89989735",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.54907608",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.66296048",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.76388491",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.30627529",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.07073773",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.3044488",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.87211779",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.74288064",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.66642669",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.12468339",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.56667243",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.47543272",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.45047042",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.38350663",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.63856779",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.88332239",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99893656",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.13772705",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.98141421",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.62762111",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.02827852",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "7.27378632",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "4.82831374",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.25575004",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.58349631",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.82894562",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.36597602",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.53378884",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.12468339",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42162227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.59578051",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.0937502",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.19847872",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35437004",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.23441073",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.33682573",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.2441669",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.15485809",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.81413053",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.4645883",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.35088572",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.88610403",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.82600011",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.3630281",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.77144112",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.09807428",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.52942909",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.03787092",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.75890177",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.315358",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.59167373",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.74939299",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.39362755",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.45958551",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.94017125",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.96614674",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.51174533",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.18001665",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.14203741",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.26909628",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.09807428",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.57972983",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.76205138",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43935037",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.9348942",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.68835471",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.10255859",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.7651911",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.99396143",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.03308622",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.42324696",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.86929691",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.57972983",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.05443935",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.32793678",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.66642669",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.97380961",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.84643878",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.15617664",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.76272951",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.58063914",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.04342512",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.00635316",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.74051936",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.60800063",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.58892648",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.87729607",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.62140565",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.00141488",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.42324696",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "4.95582706",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.04500531",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.47697236",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.51025834",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "5.86929691",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.13122649",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.06842559",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.80211838",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.37161185",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.768321",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.60394382",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.46302946",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.00635316",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.170484",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.6767538",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.68586095",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.28226675",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.04500531",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.32435896",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.18620862",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.89440283",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "4.95582706",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10479323",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55961524",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.28039584",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.51471269",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.56068163",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.10249936",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.97635091",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.6167711",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.87493073",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.78558765",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.25749537",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.04025471",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.89715387",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.86646806",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.03068526",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.39692966",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.88038408",
            "series": "Observed"
          },
          {
            "x": "5",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.73979291",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.61312811",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.07534603",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "6.59441346",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.59842196",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.170484",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.0591232",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.60665019",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.55108034",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.50125821",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.6094718",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.44888939",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.66642669",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.43807931",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.97888576",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.34913899",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.30991828",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.89440283",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "4.60517019",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.66988092",
            "series": "Observed"
          },
          {
            "x": "4",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "6.72503364",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.07534603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.80814249",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.7235851",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.35088572",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.66296048",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.13772705",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.96357934",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "7.00850518",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.50125821",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.88053299",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.87773578",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.99146455",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.315358",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.01371516",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.82008293",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.6347896",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.25958146",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.53813982",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.05208917",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "5.88887796",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.295266",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.22455843",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.38181602",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.03787092",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "5.91079664",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.08221891",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.42810527",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.77422389",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.453625",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "5.74620319",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.75343792",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.94803499",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.50125821",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.69456206",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.22653667",
            "series": "Observed"
          },
          {
            "x": "17",
            "y": "6.86901445",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.61069604",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.16541785",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "4.81218436",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "6.67708346",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.13556489",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.4161004",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.35784227",
            "series": "Observed"
          },
          {
            "x": "8",
            "y": "5.19295685",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.78382518",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.01371516",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.28971557",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.86929691",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.54103",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.04025471",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.90263333",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.86078622",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.81673588",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.80239476",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.72684775",
            "series": "Observed"
          },
          {
            "x": "7",
            "y": "6.1633148",
            "series": "Observed"
          },
          {
            "x": "11",
            "y": "5.82894562",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.13772705",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.29831737",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "5.75257264",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.53733427",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.92692603",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.89715387",
            "series": "Observed"
          },
          {
            "x": "18",
            "y": "6.62007321",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.37842618",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.57972983",
            "series": "Observed"
          },
          {
            "x": "9",
            "y": "5.70378247",
            "series": "Observed"
          },
          {
            "x": "6",
            "y": "5.96614674",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.10924758",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.57215403",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.06842559",
            "series": "Observed"
          },
          {
            "x": "10",
            "y": "5.25749537",
            "series": "Observed"
          },
          {
            "x": "14",
            "y": "6.72022016",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.24027585",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.27098843",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "5.95324333",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "15",
            "y": "6.56807791",
            "series": "Observed"
          },
          {
            "x": "16",
            "y": "6.15697899",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.15273269",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.02344759",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "5.81413053",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.17586727",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.2146081",
            "series": "Observed"
          },
          {
            "x": "12",
            "y": "6.56948142",
            "series": "Observed"
          },
          {
            "x": "13",
            "y": "6.26339826",
            "series": "Observed"
          },
          {
            "x": "1",
            "y": "5.62297658382357",
            "series": "OLS projection"
          },
          {
            "x": "18",
            "y": "6.50857860578651",
            "series": "OLS projection"
          },
          {
            "x": "1",
            "y": "3.95553423129222",
            "series": "IV moment line"
          },
          {
            "x": "18",
            "y": "7.15259902190114",
            "series": "IV moment line"
          }
        ],
        "plotFile": "econ23-peer-display-corrected/realdata-person-r/plot.svg",
        "plotSHA256": "ce38a2ec2b4d81d1c4bd36223a27782c565c58e34da1a193f6972069f522d7dd",
        "files": [
          {
            "file": "econ23-peer-display-corrected/realdata-person-r/full-result.Rtext",
            "sha256": "8697747c1312f2bd518a8e40ec1c3036ea2c06f6deadf9ded8b3543781f0fa1a"
          },
          {
            "file": "econ23-peer-display-corrected/realdata-person-r/plot-points.csv",
            "sha256": "c608b24baef69cae685d61ba5c91adcb41a087f218d557b82018bf5492ed8a26"
          },
          {
            "file": "econ23-peer-display-corrected/realdata-person-r/plot.svg",
            "sha256": "ce38a2ec2b4d81d1c4bd36223a27782c565c58e34da1a193f6972069f522d7dd"
          },
          {
            "file": "econ23-peer-display-corrected/realdata-person-r/summary.csv",
            "sha256": "d5edfd61b6b47abff4daacc2e77409174fb39844cff436821f93db2db0e64ac0"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "company-paired": {
        "api": "realdata",
        "variant": "company-paired",
        "language": "r",
        "codeFile": "econ23-code/realdata-company-paired.R",
        "codeSHA256": "ae4689422c980b16da24980c51f116697257a7b0006db01c31af1233e0fcdcec",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"realdata\"\nINPUT<-list(kind=\"company\",options=list(frame=\"paired\"))\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"realdata\"\nINPUT<-list(kind=\"company\",options=list(frame=\"paired\"))\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "company",
          "options": {
            "frame": "paired"
          }
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=2.750000000, sensitivityAdjustedContrast=2.750000000, group0-commonUnits=75.000000000, group1-commonUnits=309.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "differenceInDifferences": "2.750000000",
          "sensitivityAdjustedContrast": "2.750000000",
          "group0-commonUnits": "75.000000000",
          "group1-commonUnits": "309.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "23.38",
            "series": "PA"
          },
          {
            "x": "1",
            "y": "21.0966666666667",
            "series": "PA"
          },
          {
            "x": "0",
            "y": "20.4305825242718",
            "series": "NJ"
          },
          {
            "x": "1",
            "y": "20.8972491909385",
            "series": "NJ"
          }
        ],
        "plotFile": "econ23-fixed-results/realdata-company-paired-r/plot.svg",
        "plotSHA256": "4f916d5ade82035741af0138d1312c8563a712fcbb0f933d89cc48b3e28ad9b2",
        "files": [
          {
            "file": "econ23-fixed-results/realdata-company-paired-r/full-result.Rtext",
            "sha256": "2287f6a878778ec047e0d761d2bad12609fd94634af9e49ab8d234a83ee47b87"
          },
          {
            "file": "econ23-fixed-results/realdata-company-paired-r/plot-points.csv",
            "sha256": "585120ea381a3812463702aff217a1f7293b9bebfedd22f1cab96d647ab75623"
          },
          {
            "file": "econ23-fixed-results/realdata-company-paired-r/plot.svg",
            "sha256": "4f916d5ade82035741af0138d1312c8563a712fcbb0f933d89cc48b3e28ad9b2"
          },
          {
            "file": "econ23-fixed-results/realdata-company-paired-r/summary.csv",
            "sha256": "d2c3de90fa693ecdfdcf9d85e9c0dfbed8c7314475502fa9356688cc259cb05a"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      },
      "company-available": {
        "api": "realdata",
        "variant": "company-available",
        "language": "r",
        "codeFile": "econ23-code/realdata-company-available.R",
        "codeSHA256": "742e4bdf04ec8d845ce5198e10ce34f50757c65169c86dc91df74dd5a3d67b1e",
        "codeText": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"realdata\"\nINPUT<-list(kind=\"company\",options=list(frame=\"available\"))\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "code": "# ECON23 independently written base-R arithmetic reproduction (finite precision).\n# Rscript econ23-public-analysis.R econ23-sources results-r\n# Reads native-field CSVs; does not read Python/JavaScript or expected answers.\n# Centered weighted sample moments divide by weight sum, not n-1. Ratios are\n# sample arithmetic, not causal identification, robust standard errors, or a\n# replication of the original papers' controlled estimates. Explicit NULL\n# numeric parameters reject. Binary64 arithmetic cannot certify tiny PSD margins.\noptions(stringsAsFactors=FALSE,digits=17)\nqnum<-function(x){if(is.null(x)||length(x)!=1||is.na(x))stop('explicit null is not a numeric parameter');s<-strsplit(as.character(x),'/',fixed=TRUE)[[1]];v<-if(length(s)==2)as.numeric(s[1])/as.numeric(s[2]) else as.numeric(s[1]);if(!is.finite(v))stop('finite numeric parameter required');v}\nparam<-function(a,key,default){if(key%in%names(a))qnum(a[[key]]) else default}\nsafe_div<-function(a,b){if(is.null(a)||is.null(b)||is.na(a)||is.na(b)||b==0)NA_real_ else a/b}\nframe_rows<-function(rows,fields){if(!nrow(rows))stop('rows required');d<-rows;if(!'id'%in%names(d))d$id<-as.character(seq_len(nrow(d))-1);if(anyDuplicated(as.character(d$id)))stop('unique IDs required');if(!'weight'%in%names(d))d$weight<-1;if(any(!is.finite(d$weight)|d$weight<0))stop('nonnegative finite weights');for(k in fields)if(!k%in%names(d))stop('observed field required');d}\nwm<-function(d,key){W<-sum(d$weight);if(!W)NA_real_ else sum(d$weight*d[[key]])/W}\nequilibrium<-function(a){b<-qnum(a$demandSlope);d<-qnum(a$supplySlope);if(min(b,d)<0)stop('nonnegative slope magnitudes');g<-param(a,'demandShifterSlope',1);h<-param(a,'supplyShifterSlope',1);A<-qnum(a$demandIntercept)+g*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+h*param(a,'supplyShifter',0)+param(a,'supplyShock',0);den<-b+d;if(!den)return(list(status=if(A==S)'price-family-with-fixed-quantity' else 'no-equilibrium',price=NA_real_,quantity=if(A==S)A else NA_real_,nonnegativePriceQuantityFeasible=A==S&&A>=0,derivatives=NULL));P<-(A-S)/den;Q<-A-b*P;list(status='unique-unconstrained-equilibrium',price=P,quantity=Q,demandSupplyResidual=Q-S-d*P,nonnegativePriceQuantityFeasible=P>=0&&Q>=0,derivatives=list(priceDemandShifter=g/den,quantityDemandShifter=d*g/den,priceSupplyShifter=-h/den,quantitySupplyShifter=b*h/den))}\nreduced_form<-function(a){pi<-qnum(a$firstStageSlope);b<-qnum(a$causalSlope);g<-param(a,'directInstrumentEffect',0);zz<-param(a,'varZ',1);vv<-param(a,'varV',1);uu<-param(a,'varU',1);zv<-param(a,'covZV',0);zu<-param(a,'covZU',0);vu<-param(a,'covVU',0);minors<-c(zz*vv-zv*zv,zz*uu-zu*zu,vv*uu-vu*vu);det<-zz*(vv*uu-vu*vu)-zv*(zv*uu-vu*zu)+zu*(zv*vu-vv*zu);if(min(c(zz,vv,uu,minors,det))< -1e-12)stop('positive semidefinite covariance required');zx<-pi*zz+zv;zy<-b*zx+g*zz+zu;xx<-pi*pi*zz+vv+2*pi*zv;xu<-pi*zu+vu;xy<-b*xx+g*zx+xu;yy<-b*b*xx+g*g*zz+uu+2*b*g*zx+2*b*xu+2*g*zu;iv<-safe_div(zy,zx);list(structuralReducedXSlope=pi,structuralReducedYSlope=b*pi+g,projectionFirstStage=safe_div(zx,zz),projectionReducedForm=safe_div(zy,zz),ivRatio=iv,olsSlope=safe_div(xy,xx),causalSlopeStipulated=b,ivMinusStipulatedSlope=iv-b,violationOverFirstStage=safe_div(g*zz+zu,zx),moments=list(varZ=zz,varX=xx,varY=yy,covZX=zx,covZY=zy,covXY=xy,covXU=xu),covariancePrincipalMinors=as.list(minors),covarianceDeterminant=det)}\nselection<-function(a){d<-frame_rows(a$rows,c('y0','y1'));if(anyNA(d$y0)||anyNA(d$y1)||any(!d$D%in%c(0,1)))stop('stipulated potential outcomes and binary D required');d$effect<-d$y1-d$y0;d<-d[d$weight>0,,drop=FALSE];if(!nrow(d))stop('positive total weight');t<-d[d$D==1,,drop=FALSE];c<-d[d$D==0,,drop=FALSE];ATE<-wm(d,'effect');ATT<-wm(t,'effect');ATU<-wm(c,'effect');t0<-wm(t,'y0');t1<-wm(t,'y1');c0<-wm(c,'y0');c1<-wm(c,'y1');gap<-t1-c0;bias<-t0-c0;p<-sum(t$weight)/sum(d$weight);list(sourceUnits=nrow(a$rows),positiveWeightUnits=nrow(d),treatedUnits=nrow(t),untreatedUnits=nrow(c),treatedWeightShare=p,ATE=ATE,ATT=ATT,ATU=ATU,meanY0Treated=t0,meanY1Treated=t1,meanY0Untreated=c0,meanY1Untreated=c1,observedDifference=gap,baselineSelectionBias=bias,selectionIdentityResidual=gap-ATT-bias,weightedATEIdentityResidual=ATE-p*ATT-(1-p)*ATU)}\niv<-function(a){d<-frame_rows(a$rows,c('y','x','z'));c<-d[d$weight>0&complete.cases(d[,c('y','x','z')]),,drop=FALSE];W<-sum(c$weight);mu<-lapply(c('y','x','z'),function(k)wm(c,k));names(mu)<-c('y','x','z');moment<-function(k,j)if(W)sum(c$weight*(c[[k]]-mu[[k]])*(c[[j]]-mu[[j]]))/W else NA_real_;xx<-moment('x','x');zz<-moment('z','z');zx<-moment('z','x');zy<-moment('z','y');xy<-moment('x','y');groups<-NULL;if(nrow(c)&&all(c$z%in%c(0,1)))groups<-lapply(0:1,function(z){g<-c[c$z==z,,drop=FALSE];list(z=z,units=nrow(g),weight=sum(g$weight),meanX=wm(g,'x'),meanY=wm(g,'y'))});list(sourceUnits=nrow(d),completePositiveWeightUnits=nrow(c),missingOrZeroWeightUnits=nrow(d)-nrow(c),completeWeight=W,means=mu,moments=list(varX=xx,varZ=zz,covZX=zx,covZY=zy,covXY=xy),firstStageProjection=safe_div(zx,zz),reducedFormProjection=safe_div(zy,zz),ivRatio=safe_div(zy,zx),olsProjection=safe_div(xy,xx),binaryInstrumentGroups=groups,completeUnitIDs=as.character(c$id))}\ndid<-function(a){d<-frame_rows(a$rows,c('before','after'));if(any(!d$group%in%c(0,1)))stop('binary group required');mode<-if('frame'%in%names(a))a$frame else 'paired';if(length(mode)!=1||is.null(mode)||!mode%in%c('paired','available'))stop('paired or available');drift<-param(a,'assumedUntreatedTrendDifference',0);valid<-d[d$weight>0,,drop=FALSE];groups<-lapply(0:1,function(group){rr<-valid[valid$group==group,,drop=FALSE];common<-rr[complete.cases(rr[,c('before','after')]),,drop=FALSE];basis<-if(mode=='paired')common else rr;b<-basis[!is.na(basis$before),,drop=FALSE];c<-basis[!is.na(basis$after),,drop=FALSE];before<-wm(b,'before');after<-wm(c,'after');list(group=group,sourceUnits=sum(d$group==group),positiveWeightUnits=nrow(rr),beforeAvailableUnits=sum(!is.na(rr$before)),afterAvailableUnits=sum(!is.na(rr$after)),commonUnits=nrow(common),beforeMean=before,afterMean=after,beforeUsedUnits=nrow(b),afterUsedUnits=nrow(c),beforeUsedWeight=sum(b$weight),afterUsedWeight=sum(c$weight),change=after-before,commonIDs=as.character(common$id))});gap<-groups[[2]]$change-groups[[1]]$change;list(sourceUnits=nrow(d),positiveWeightUnits=nrow(valid),frame=mode,groups=groups,differenceInDifferences=gap,assumedUntreatedTrendDifference=drift,sensitivityAdjustedContrast=gap-drift)}\nread_sources<-function(src){read<-function(name)read.csv(file.path(src,name),check.names=FALSE,colClasses='character',na.strings=character(),fileEncoding='UTF-8-BOM');raw<-read('actual90-KOR-growth-and-CPI-original-1980-2024.csv');country<-do.call(rbind,lapply(1980:2024,function(year){y<-raw[raw$year==as.character(year)&raw$indicatorID=='NY.GDP.MKTP.KD.ZG',];x<-raw[raw$year==as.character(year)&raw$indicatorID=='FP.CPI.TOTL.ZG',];data.frame(id=paste0('KOR:',year),sourceRow=paste(y$originalSourceRow,x$originalSourceRow,sep='|'),year=year,y=as.numeric(y$valueToken),x=as.numeric(x$valueToken),z=as.numeric(x$valueToken),weight=1)}));raw<-read('actual3613-NLS-original52-fields.csv');person<-data.frame(id=paste0('nls:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalID=raw$id,originalWeight=raw$weight,y=suppressWarnings(as.numeric(raw$lwage76)),x=suppressWarnings(as.numeric(raw$ed76)),z=suppressWarnings(as.numeric(raw$nearc4)),weight=1);raw<-read('actual410-NJPA-original46-fields.csv');fte<-function(suffix){m<-sapply(paste0(c('EMPFT','NMGRS','EMPPT'),suffix),function(k)suppressWarnings(as.numeric(raw[[k]])));m[,1]+m[,2]+.5*m[,3]};company<-data.frame(id=paste0('store:',seq_len(nrow(raw))),sourceRow=as.character(seq_len(nrow(raw))),originalSheet=raw$SHEET,group=as.integer(raw$STATE),before=fte(''),after=fte('2'),status2=raw$STATUS2,chain=raw$CHAIN,weight=1);list(country=country,person=person,company=company)}\nrealdata<-function(models,kind,options=list()){if(is.null(options)||!is.list(options))stop('options object required');if(kind=='country'){start<-param(options,'startYear',1980);end<-param(options,'endYear',2024);if(start!=as.integer(start)||end!=as.integer(end)||start<1980||end>2024||start>end)stop('valid year range');d<-models[[kind]];return(iv(list(rows=d[d$year>=start&d$year<=end,,drop=FALSE])))};if(kind=='person')return(iv(list(rows=models[[kind]])));if(kind=='company')return(did(list(rows=models[[kind]],frame=if('frame'%in%names(options))options$frame else 'paired',assumedUntreatedTrendDifference=param(options,'assumedUntreatedTrendDifference',0))));stop('known actual case')}\nAPI<-\"realdata\"\nINPUT<-list(kind=\"company\",options=list(frame=\"available\"))\n\nrun_fixed<-function(api,a,out,src){\n r<-if(api=='equilibrium')equilibrium(a) else if(api=='reducedForm')reduced_form(a) else if(api=='selection')selection(a) else if(api=='iv')iv(a) else if(api=='did')did(a) else realdata(read_sources(src),a$kind,if(is.null(a$options))list() else a$options)\n dir.create(out,recursive=TRUE,showWarnings=FALSE);points<-list();summary<-list();add<-function(x,y,s){if(!is.na(y))points[[length(points)+1L]]<<-data.frame(x=x,y=y,series=s)}\n if(api=='equilibrium'){summary<-r[c('price','quantity')];A<-qnum(a$demandIntercept)+param(a,'demandShifterSlope',1)*param(a,'demandShifter',0)+param(a,'demandShock',0);S<-qnum(a$supplyIntercept)+param(a,'supplyShifterSlope',1)*param(a,'supplyShifter',0)+param(a,'supplyShock',0);for(p in seq(0,40,5)){add(p,A-qnum(a$demandSlope)*p,'Demand');add(p,S+qnum(a$supplySlope)*p,'Supply')};xl<-'Price (assumed units)';yl<-'Quantity (assumed units)';title<-'Stipulated market schedules'\n }else if(api=='reducedForm'){summary<-r[c('projectionFirstStage','projectionReducedForm','ivRatio','olsSlope')];for(z in -2:2)add(z,r$structuralReducedYSlope*z,'Structural path V=U=0');xl<-'Instrument Z (assumed)';yl<-'Outcome Y (assumed)';title<-'Stipulated path, not sampled observations'\n }else if(api=='selection'){summary<-r[c('ATE','ATT','ATU','observedDifference')];for(i in seq_len(nrow(a$rows)))add(i,a$rows$y1[i]-a$rows$y0[i],'Stipulated unit effect');xl<-'Unit A=1, B=2';yl<-'Potential-outcome difference';title<-'Both potential outcomes are stipulated'\n }else if((api%in%c('iv','realdata'))&&!identical(a$kind,'company')){d<-if(api=='iv')a$rows else read_sources(src)[[a$kind]];good<-d[complete.cases(d[,c('x','y','z')]) & if('weight'%in%names(d))d$weight>0 else rep(TRUE,nrow(d)),,drop=FALSE];summary<-r[c('completePositiveWeightUnits','firstStageProjection','ivRatio','olsProjection')];for(i in seq_len(nrow(good)))add(good$x[i],good$y[i],'Observed');if(nrow(good))for(key in c('olsProjection','ivRatio'))if(!is.na(r[[key]])){b<-r[[key]];alpha<-r$means$y-b*r$means$x;for(x in range(good$x))add(x,alpha+b*x,if(key=='olsProjection')'OLS projection' else 'IV moment line')};country<-identical(a$kind,'country');person<-identical(a$kind,'person');xl<-if(country)'CPI inflation (%)' else if(person)'Schooling (years)' else 'Observed X';yl<-if(country)'Real GDP growth (%)' else if(person)'Log wage (cents/hour)' else 'Observed Y';title<-'Recorded sample; lines are not causal certification'\n }else{summary<-r[c('differenceInDifferences','sensitivityAdjustedContrast')];for(g in r$groups){summary[[paste0('group',g$group,'-commonUnits')]]<-g$commonUnits;for(x in 0:1)add(x,if(x==0)g$beforeMean else g$afterMean,if(api=='realdata')if(g$group==0)'PA' else 'NJ' else paste('Group',g$group))};xl<-'Wave (0=before, 1=after)';yl<-if(api=='realdata')'FTE persons' else 'Outcome (assumed units)';mode<-if(api=='realdata')a$options$frame else a$frame;title<-paste('Group means:',mode,'frame')}\n display<-function(v)if(is.null(v)||is.na(v))'undefined' else sprintf('%.9f',unname(v))\n write.csv(data.frame(metric=names(summary),value=vapply(summary,display,'')),file.path(out,'summary.csv'),row.names=FALSE,na='');pp<-do.call(rbind,points);write.csv(pp,file.path(out,'plot-points.csv'),row.names=FALSE,na='');dput(r,file.path(out,'full-result.Rtext'))\n svg(file.path(out,'plot.svg'),width=5.6,height=4.6,pointsize=14);par(mar=c(5.4,5.6,5.2,1.2),mgp=c(3.4,1,0));plot(range(pp$x),range(pp$y),type='n',xlab=xl,ylab=yl,axes=FALSE);axis(1,at=pretty(pp$x,n=3));axis(2,at=pretty(pp$y,n=4),las=1,cex.axis=.85);box();grid(col='#dddddd');cols<-c('#355c72','#a55336','#507956');ss<-unique(pp$series);for(i in seq_along(ss)){v<-pp[pp$series==ss[i],];if(ss[i]%in%c('Observed','Stipulated unit effect'))points(v$x,v$y,pch=16,cex=if(ss[i]=='Observed').35 else .9,col=adjustcolor(cols[i],if(ss[i]=='Observed').45 else 1)) else lines(v$x,v$y,type=if(nrow(v)<=2)'b' else 'l',pch=16,col=cols[i],lwd=1.6)};legend('topleft',legend=ss,col=cols[seq_along(ss)],lty=1,cex=.65,bty='n',inset=c(0,-.3),xpd=NA);mtext(title,side=3,line=3.8,cex=.6);dev.off();cat(paste(names(summary),vapply(summary,display,''),sep='=',collapse=', '),'\\n')\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(run_fixed(API,INPUT,if(length(args))args[1] else 'fixed-results',if(length(args)>1)args[2] else 'econ23-sources'),error=function(error){cat('Rejected declared input: ',conditionMessage(error),'\\n',file=stderr());quit(status=2)})\n",
        "inputFiles": [
          {
            "file": "econ23-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "970797ded1327efc1fa375aab80a01959173328944780d43d124f25ce5a9013d"
          },
          {
            "file": "econ23-sources/actual410-NJPA-original46-fields.csv",
            "sha256": "1a1a600fc0a0d2ef56ecac38f06ae211e3d2e6a0e5328b397799de1815531f44"
          },
          {
            "file": "econ23-sources/actual90-KOR-growth-and-CPI-original-1980-2024.csv",
            "sha256": "f93d3e6eafb61f74e0ea9b07dcf645e449b5449029407ab08905ca49de4a3542"
          }
        ],
        "input": {
          "kind": "company",
          "options": {
            "frame": "available"
          }
        },
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "differenceInDifferences=2.753605783, sensitivityAdjustedContrast=2.753605783, group0-commonUnits=75.000000000, group1-commonUnits=309.000000000 \n",
        "stderr": "During startup - Warning messages:\n1: Setting LC_COLLATE=C.UTF-8 failed \n2: Setting LC_CTYPE=C.UTF-8 failed \n3: Setting LC_MONETARY=C.UTF-8 failed \n4: Setting LC_TIME=C.UTF-8 failed \n",
        "summary": {
          "differenceInDifferences": "2.753605783",
          "sensitivityAdjustedContrast": "2.753605783",
          "group0-commonUnits": "75.000000000",
          "group1-commonUnits": "309.000000000"
        },
        "plotPoints": [
          {
            "x": "0",
            "y": "23.3311688311688",
            "series": "PA"
          },
          {
            "x": "1",
            "y": "21.1655844155844",
            "series": "PA"
          },
          {
            "x": "0",
            "y": "20.4394080996885",
            "series": "NJ"
          },
          {
            "x": "1",
            "y": "21.0274294670846",
            "series": "NJ"
          }
        ],
        "plotFile": "econ23-fixed-results/realdata-company-available-r/plot.svg",
        "plotSHA256": "033d7992e8a10f03c8d9337311edcbb3f8b17a8b9c554aa23aaef6283af37d19",
        "files": [
          {
            "file": "econ23-fixed-results/realdata-company-available-r/full-result.Rtext",
            "sha256": "f4ab1eb8d8f5db367bb62ba8824c9a80ad16004819b4f65ed2c750cbf5efa12b"
          },
          {
            "file": "econ23-fixed-results/realdata-company-available-r/plot-points.csv",
            "sha256": "3b19a95d117420b3035211e3c0e341b40242c8ad7e2554c687f2258b7a39c901"
          },
          {
            "file": "econ23-fixed-results/realdata-company-available-r/plot.svg",
            "sha256": "033d7992e8a10f03c8d9337311edcbb3f8b17a8b9c554aa23aaef6283af37d19"
          },
          {
            "file": "econ23-fixed-results/realdata-company-available-r/summary.csv",
            "sha256": "34e92af12bfd4e88bdda73f0e5f4e4d0852af70671b807eea9daa0745927a974"
          }
        ],
        "scope": "Actually executed fixed example, separate from browser controls. Python Fraction and finite-precision base R. No causal identification certification."
      }
    }
  }
}
