{
  "ratio": {
    "python": {
      "denominator-sequence": {
        "api": "ratio",
        "variant": "denominator-sequence",
        "language": "python",
        "codeFile": "metr18-code/ratio-denominator-sequence.py",
        "codeSHA256": "aca52173a680a13659d6ed72383ecb021be3a92c062769805a46d0e538dde29e",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='ratio'\nINPUT={'delta': '1', 'pis': ['1/2', '1/10', '1/100', '0']}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='ratio'\nINPUT={'delta': '1', 'pis': ['1/2', '1/10', '1/100', '0']}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "1",
          "pis": [
            "1/2",
            "1/10",
            "1/100",
            "0"
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "firstRatio=2.000000000, lastFiniteRatio=100.000000000, undefinedRatios=1.000000000\r\n",
        "stderr": "",
        "summary": {
          "firstRatio": "2.000000000",
          "lastFiniteRatio": "100.000000000",
          "undefinedRatios": "1.000000000"
        },
        "plotPoints": [
          {
            "x": "1/2",
            "y": "2",
            "series": "Defined ratio"
          },
          {
            "x": "1/10",
            "y": "10",
            "series": "Defined ratio"
          },
          {
            "x": "1/100",
            "y": "100",
            "series": "Defined ratio"
          }
        ],
        "plotFile": "metr18-fixed-results/ratio-denominator-sequence-python/plot.svg",
        "plotSHA256": "0cc781d29a5e00efc42a4c1c0e6ac50f8c2769d447b42eacb7b96b7a2276a5a6",
        "files": [
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-python/full.json",
            "sha256": "3e39e5c338d71a6c966cdade203a6fb4c703cf5332e4a87ff3cbca4ff9d1af1b"
          },
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-python/plot-points.csv",
            "sha256": "90bb947355c582a011e05cced2adaed5ab8e7fd56e5616647884fabe9dc902d6"
          },
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-python/plot.svg",
            "sha256": "0cc781d29a5e00efc42a4c1c0e6ac50f8c2769d447b42eacb7b96b7a2276a5a6"
          },
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-python/summary.csv",
            "sha256": "f4d944dbe283a3e0ccaccba6fadcc27b9c3ad0f683919f3d920a08d517233d71"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    },
    "r": {
      "denominator-sequence": {
        "api": "ratio",
        "variant": "denominator-sequence",
        "language": "r",
        "codeFile": "metr18-code/ratio-denominator-sequence.R",
        "codeSHA256": "5f8d1fe1c939f2df64de86aa0ce709d91c1d52d1505dc99b1e0c2c3172f243fe",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"ratio\"\nINPUT=list(delta=\"1\",pis=list(\"1/2\",\"1/10\",\"1/100\",\"0\"))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"ratio\"\nINPUT=list(delta=\"1\",pis=list(\"1/2\",\"1/10\",\"1/100\",\"0\"))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "1",
          "pis": [
            "1/2",
            "1/10",
            "1/100",
            "0"
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "firstRatio=2.000000000, lastFiniteRatio=100.000000000, undefinedRatios=1.000000000 \r\n",
        "stderr": "",
        "summary": {
          "firstRatio": "2.000000000",
          "lastFiniteRatio": "100.000000000",
          "undefinedRatios": "1.000000000"
        },
        "plotPoints": [
          {
            "x": "0.5",
            "y": "2",
            "series": "Defined ratio"
          },
          {
            "x": "0.10000000000000001",
            "y": "10",
            "series": "Defined ratio"
          },
          {
            "x": "0.01",
            "y": "100",
            "series": "Defined ratio"
          }
        ],
        "plotFile": "metr18-fixed-results/ratio-denominator-sequence-r/plot.svg",
        "plotSHA256": "317db7dc049318e60682b7f1c4ec18407ad03c85d4f24830fd5cdbc062341fc0",
        "files": [
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-r/full-result.Rtext",
            "sha256": "7e31ffc9cb7d74636193bda200f647dca54aebebb3122c6980d13c5204e29688"
          },
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-r/plot-points.csv",
            "sha256": "3e97e8494cdee9caad6364cb1839299a3466dc462ce7f8eea805686a51a34611"
          },
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-r/plot.svg",
            "sha256": "317db7dc049318e60682b7f1c4ec18407ad03c85d4f24830fd5cdbc062341fc0"
          },
          {
            "file": "metr18-fixed-results/ratio-denominator-sequence-r/summary.csv",
            "sha256": "183df5e9ed147c9f2ceb1f3e28ba92b266c6bf254fc0a93914dbf28171231d46"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    }
  },
  "firststage": {
    "python": {
      "four-row-hand-calculation": {
        "api": "firststage",
        "variant": "four-row-hand-calculation",
        "language": "python",
        "codeFile": "metr18-code/firststage-four-row-hand-calculation.py",
        "codeSHA256": "6b5756c75f44f1f62e78fa54f45044593f45a2d724ef2a3bc1a1dd5eefe75517",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='firststage'\nINPUT={'rows': [{'id': 'a', 'y': '0', 'x': '0', 'z': ['-1']}, {'id': 'b', 'y': '1', 'x': '1', 'z': ['-1']}, {'id': 'c', 'y': '3', 'x': '1', 'z': ['1']}, {'id': 'd', 'y': '4', 'x': '2', 'z': ['1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='firststage'\nINPUT={'rows': [{'id': 'a', 'y': '0', 'x': '0', 'z': ['-1']}, {'id': 'b', 'y': '1', 'x': '1', 'z': ['-1']}, {'id': 'c', 'y': '3', 'x': '1', 'z': ['1']}, {'id': 'd', 'y': '4', 'x': '2', 'z': ['1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "0",
              "x": "0",
              "z": [
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "1",
              "x": "1",
              "z": [
                "-1"
              ]
            },
            {
              "id": "c",
              "y": "3",
              "x": "1",
              "z": [
                "1"
              ]
            },
            {
              "id": "d",
              "y": "4",
              "x": "2",
              "z": [
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "rows=4.000000000, declaredInstruments=1.000000000, centeredRank=1.000000000, classicalF=2.000000000, HC0Wald=4.000000000, twoSLS=3.000000000\r\n",
        "stderr": "",
        "summary": {
          "rows": "4.000000000",
          "declaredInstruments": "1.000000000",
          "centeredRank": "1.000000000",
          "classicalF": "2.000000000",
          "HC0Wald": "4.000000000",
          "twoSLS": "3.000000000"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "0",
            "series": "Original rows"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "2",
            "series": "Original rows"
          }
        ],
        "plotFile": "metr18-fixed-results/firststage-four-row-hand-calculation-python/plot.svg",
        "plotSHA256": "6ce8ff826da3cb05f834d4d5d4be54305adbf4eed76263261c04f2a9cde731f1",
        "files": [
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-python/full.json",
            "sha256": "63935504eb85ee164574b088cbfaa29d01549f301dfa12b95660cf4239c41782"
          },
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-python/plot-points.csv",
            "sha256": "dc1520bbf9e58354329dde7c387734a3e161fd24127447a426d032d38649a37a"
          },
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-python/plot.svg",
            "sha256": "6ce8ff826da3cb05f834d4d5d4be54305adbf4eed76263261c04f2a9cde731f1"
          },
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-python/summary.csv",
            "sha256": "599bf02c5af49884a9c9339b562b01db9f5af6117ca5ffa7fbee2a4707b4823b"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "redundant-declared-columns": {
        "api": "firststage",
        "variant": "redundant-declared-columns",
        "language": "python",
        "codeFile": "metr18-code/firststage-redundant-declared-columns.py",
        "codeSHA256": "52d73a349cbdfcb932082c6442edb34a0d55207cf8e9876d14c78df0e846400b",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='firststage'\nINPUT={'rows': [{'id': 'a', 'y': '0', 'x': '0', 'z': ['-1', '-1']}, {'id': 'b', 'y': '1', 'x': '1', 'z': ['-1', '-1']}, {'id': 'c', 'y': '3', 'x': '1', 'z': ['1', '1']}, {'id': 'd', 'y': '4', 'x': '2', 'z': ['1', '1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='firststage'\nINPUT={'rows': [{'id': 'a', 'y': '0', 'x': '0', 'z': ['-1', '-1']}, {'id': 'b', 'y': '1', 'x': '1', 'z': ['-1', '-1']}, {'id': 'c', 'y': '3', 'x': '1', 'z': ['1', '1']}, {'id': 'd', 'y': '4', 'x': '2', 'z': ['1', '1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "0",
              "x": "0",
              "z": [
                "-1",
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "1",
              "x": "1",
              "z": [
                "-1",
                "-1"
              ]
            },
            {
              "id": "c",
              "y": "3",
              "x": "1",
              "z": [
                "1",
                "1"
              ]
            },
            {
              "id": "d",
              "y": "4",
              "x": "2",
              "z": [
                "1",
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "rows=4.000000000, declaredInstruments=2.000000000, centeredRank=1.000000000, classicalF=undefined, HC0Wald=undefined, twoSLS=undefined\r\n",
        "stderr": "",
        "summary": {
          "rows": "4.000000000",
          "declaredInstruments": "2.000000000",
          "centeredRank": "1.000000000",
          "classicalF": "undefined",
          "HC0Wald": "undefined",
          "twoSLS": "undefined"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "0",
            "series": "Original rows"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "2",
            "series": "Original rows"
          }
        ],
        "plotFile": "metr18-fixed-results/firststage-redundant-declared-columns-python/plot.svg",
        "plotSHA256": "6ce8ff826da3cb05f834d4d5d4be54305adbf4eed76263261c04f2a9cde731f1",
        "files": [
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-python/full.json",
            "sha256": "5b1b1b18cc72d43370bcc27c731802e855ca6ff28be16a68b2a53e7689213b39"
          },
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-python/plot-points.csv",
            "sha256": "dc1520bbf9e58354329dde7c387734a3e161fd24127447a426d032d38649a37a"
          },
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-python/plot.svg",
            "sha256": "6ce8ff826da3cb05f834d4d5d4be54305adbf4eed76263261c04f2a9cde731f1"
          },
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-python/summary.csv",
            "sha256": "8fc7a813d8a0afd931a84e2cadf37d5ad92bf958fcb332c1a8ca849b543e377a"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    },
    "r": {
      "four-row-hand-calculation": {
        "api": "firststage",
        "variant": "four-row-hand-calculation",
        "language": "r",
        "codeFile": "metr18-code/firststage-four-row-hand-calculation.R",
        "codeSHA256": "ed7c7c620a4d377f5ecaafe8c2ec6de215559a1de874857705aa934da886c081",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"firststage\"\nINPUT=list(rows=list(list(id=\"a\",y=\"0\",x=\"0\",z=list(\"-1\")),list(id=\"b\",y=\"1\",x=\"1\",z=list(\"-1\")),list(id=\"c\",y=\"3\",x=\"1\",z=list(\"1\")),list(id=\"d\",y=\"4\",x=\"2\",z=list(\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"firststage\"\nINPUT=list(rows=list(list(id=\"a\",y=\"0\",x=\"0\",z=list(\"-1\")),list(id=\"b\",y=\"1\",x=\"1\",z=list(\"-1\")),list(id=\"c\",y=\"3\",x=\"1\",z=list(\"1\")),list(id=\"d\",y=\"4\",x=\"2\",z=list(\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "0",
              "x": "0",
              "z": [
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "1",
              "x": "1",
              "z": [
                "-1"
              ]
            },
            {
              "id": "c",
              "y": "3",
              "x": "1",
              "z": [
                "1"
              ]
            },
            {
              "id": "d",
              "y": "4",
              "x": "2",
              "z": [
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "rows=4.000000000, declaredInstruments=1.000000000, centeredRank=1.000000000, classicalF=2.000000000, HC0Wald=4.000000000, twoSLS=3.000000000 \r\n",
        "stderr": "",
        "summary": {
          "rows": "4.000000000",
          "declaredInstruments": "1.000000000",
          "centeredRank": "1.000000000",
          "classicalF": "2.000000000",
          "HC0Wald": "4.000000000",
          "twoSLS": "3.000000000"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "0",
            "series": "Original rows"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "2",
            "series": "Original rows"
          }
        ],
        "plotFile": "metr18-fixed-results/firststage-four-row-hand-calculation-r/plot.svg",
        "plotSHA256": "3a4f4b8956515f54bbe447b0dc5e017e3e7ae3719d0e7f1ce70b6cc08615d682",
        "files": [
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-r/full-result.Rtext",
            "sha256": "a7af1d28c21c63e4b9ab698ec4149b06cb9f6c340889cde8069b9aa0a3cabd9c"
          },
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-r/plot-points.csv",
            "sha256": "a81db73af2467160bbffad0e452ef6fa3a3a96ee88b114400a982a7d9286a9b8"
          },
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-r/plot.svg",
            "sha256": "3a4f4b8956515f54bbe447b0dc5e017e3e7ae3719d0e7f1ce70b6cc08615d682"
          },
          {
            "file": "metr18-fixed-results/firststage-four-row-hand-calculation-r/summary.csv",
            "sha256": "265241b4ef9d7a380e9f2248575708eeb51c76afc872f33a599541c02bd70379"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "redundant-declared-columns": {
        "api": "firststage",
        "variant": "redundant-declared-columns",
        "language": "r",
        "codeFile": "metr18-code/firststage-redundant-declared-columns.R",
        "codeSHA256": "61a806059347fa9be07eafa88dcbf8f64c00fc7fa87fae9abe3e010517e2286a",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"firststage\"\nINPUT=list(rows=list(list(id=\"a\",y=\"0\",x=\"0\",z=list(\"-1\",\"-1\")),list(id=\"b\",y=\"1\",x=\"1\",z=list(\"-1\",\"-1\")),list(id=\"c\",y=\"3\",x=\"1\",z=list(\"1\",\"1\")),list(id=\"d\",y=\"4\",x=\"2\",z=list(\"1\",\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"firststage\"\nINPUT=list(rows=list(list(id=\"a\",y=\"0\",x=\"0\",z=list(\"-1\",\"-1\")),list(id=\"b\",y=\"1\",x=\"1\",z=list(\"-1\",\"-1\")),list(id=\"c\",y=\"3\",x=\"1\",z=list(\"1\",\"1\")),list(id=\"d\",y=\"4\",x=\"2\",z=list(\"1\",\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "0",
              "x": "0",
              "z": [
                "-1",
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "1",
              "x": "1",
              "z": [
                "-1",
                "-1"
              ]
            },
            {
              "id": "c",
              "y": "3",
              "x": "1",
              "z": [
                "1",
                "1"
              ]
            },
            {
              "id": "d",
              "y": "4",
              "x": "2",
              "z": [
                "1",
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "rows=4.000000000, declaredInstruments=2.000000000, centeredRank=1.000000000, classicalF=undefined, HC0Wald=undefined, twoSLS=undefined \r\n",
        "stderr": "",
        "summary": {
          "rows": "4.000000000",
          "declaredInstruments": "2.000000000",
          "centeredRank": "1.000000000",
          "classicalF": "undefined",
          "HC0Wald": "undefined",
          "twoSLS": "undefined"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "0",
            "series": "Original rows"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Original rows"
          },
          {
            "x": "1",
            "y": "2",
            "series": "Original rows"
          }
        ],
        "plotFile": "metr18-fixed-results/firststage-redundant-declared-columns-r/plot.svg",
        "plotSHA256": "3a4f4b8956515f54bbe447b0dc5e017e3e7ae3719d0e7f1ce70b6cc08615d682",
        "files": [
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-r/full-result.Rtext",
            "sha256": "a179ba9e1ba7d59c7842e2e4de3250978fc7b02657d2551d93e0bd07256c5415"
          },
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-r/plot-points.csv",
            "sha256": "a81db73af2467160bbffad0e452ef6fa3a3a96ee88b114400a982a7d9286a9b8"
          },
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-r/plot.svg",
            "sha256": "3a4f4b8956515f54bbe447b0dc5e017e3e7ae3719d0e7f1ce70b6cc08615d682"
          },
          {
            "file": "metr18-fixed-results/firststage-redundant-declared-columns-r/summary.csv",
            "sha256": "dadc3c7d119d22ef71ce970c26a00f37c5d55db57959f297e15f57dab5ddbab1"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    }
  },
  "ar": {
    "python": {
      "known-normal-slopes": {
        "api": "ar",
        "variant": "known-normal-slopes",
        "language": "python",
        "codeFile": "metr18-code/ar-known-normal-slopes.py",
        "codeSHA256": "42afca1311fc999bb5da711662094e04bca7c674b98d3b20879fe80c6bce22eb",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='ar'\nINPUT={'delta': '1/5', 'pi': '1/10', 'covariance': [['1/25', '1/100'], ['1/100', '9/100']], 'beta0': '2', 'criticalValue': '4', 'gridLow': '-4', 'gridHigh': '8'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='ar'\nINPUT={'delta': '1/5', 'pi': '1/10', 'covariance': [['1/25', '1/100'], ['1/100', '9/100']], 'beta0': '2', 'criticalValue': '4', 'gridLow': '-4', 'gridHigh': '8'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "1/5",
          "pi": "1/10",
          "covariance": [
            [
              "1/25",
              "1/100"
            ],
            [
              "1/100",
              "9/100"
            ]
          ],
          "beta0": "2",
          "criticalValue": "4",
          "gridLow": "-4",
          "gridHigh": "8"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta0=2.000000000, nullMoment=0.000000000, nullVariance=0.360000000, statistic=0.000000000, positiveInfinity=0.000000000, zeroOverZero=0.000000000, nonrejected=1.000000000\r\n",
        "stderr": "",
        "summary": {
          "beta0": "2.000000000",
          "nullMoment": "0.000000000",
          "nullVariance": "0.360000000",
          "statistic": "0.000000000",
          "positiveInfinity": "0.000000000",
          "zeroOverZero": "0.000000000",
          "nonrejected": "1.000000000"
        },
        "plotPoints": [
          {
            "x": "-4",
            "y": "3/13",
            "series": "Finite null statistic"
          },
          {
            "x": "-39/10",
            "y": "3481/14869",
            "series": "Finite null statistic"
          },
          {
            "x": "-19/5",
            "y": "841/3539",
            "series": "Finite null statistic"
          },
          {
            "x": "-37/10",
            "y": "1083/4487",
            "series": "Finite null statistic"
          },
          {
            "x": "-18/5",
            "y": "196/799",
            "series": "Finite null statistic"
          },
          {
            "x": "-7/2",
            "y": "121/485",
            "series": "Finite null statistic"
          },
          {
            "x": "-17/5",
            "y": "81/319",
            "series": "Finite null statistic"
          },
          {
            "x": "-33/10",
            "y": "2809/10861",
            "series": "Finite null statistic"
          },
          {
            "x": "-16/5",
            "y": "169/641",
            "series": "Finite null statistic"
          },
          {
            "x": "-31/10",
            "y": "867/3223",
            "series": "Finite null statistic"
          },
          {
            "x": "-3",
            "y": "25/91",
            "series": "Finite null statistic"
          },
          {
            "x": "-29/10",
            "y": "2401/8549",
            "series": "Finite null statistic"
          },
          {
            "x": "-14/5",
            "y": "48/167",
            "series": "Finite null statistic"
          },
          {
            "x": "-27/10",
            "y": "2209/7501",
            "series": "Finite null statistic"
          },
          {
            "x": "-13/5",
            "y": "529/1751",
            "series": "Finite null statistic"
          },
          {
            "x": "-5/2",
            "y": "9/29",
            "series": "Finite null statistic"
          },
          {
            "x": "-12/5",
            "y": "121/379",
            "series": "Finite null statistic"
          },
          {
            "x": "-23/10",
            "y": "1849/5621",
            "series": "Finite null statistic"
          },
          {
            "x": "-11/5",
            "y": "147/433",
            "series": "Finite null statistic"
          },
          {
            "x": "-21/10",
            "y": "1681/4789",
            "series": "Finite null statistic"
          },
          {
            "x": "-2",
            "y": "4/11",
            "series": "Finite null statistic"
          },
          {
            "x": "-19/10",
            "y": "507/1343",
            "series": "Finite null statistic"
          },
          {
            "x": "-9/5",
            "y": "361/919",
            "series": "Finite null statistic"
          },
          {
            "x": "-17/10",
            "y": "1369/3341",
            "series": "Finite null statistic"
          },
          {
            "x": "-8/5",
            "y": "3/7",
            "series": "Finite null statistic"
          },
          {
            "x": "-3/2",
            "y": "49/109",
            "series": "Finite null statistic"
          },
          {
            "x": "-7/5",
            "y": "289/611",
            "series": "Finite null statistic"
          },
          {
            "x": "-13/10",
            "y": "363/727",
            "series": "Finite null statistic"
          },
          {
            "x": "-6/5",
            "y": "64/121",
            "series": "Finite null statistic"
          },
          {
            "x": "-11/10",
            "y": "961/1709",
            "series": "Finite null statistic"
          },
          {
            "x": "-1",
            "y": "3/5",
            "series": "Finite null statistic"
          },
          {
            "x": "-9/10",
            "y": "841/1309",
            "series": "Finite null statistic"
          },
          {
            "x": "-4/5",
            "y": "49/71",
            "series": "Finite null statistic"
          },
          {
            "x": "-7/10",
            "y": "81/109",
            "series": "Finite null statistic"
          },
          {
            "x": "-3/5",
            "y": "169/211",
            "series": "Finite null statistic"
          },
          {
            "x": "-1/2",
            "y": "25/29",
            "series": "Finite null statistic"
          },
          {
            "x": "-2/5",
            "y": "12/13",
            "series": "Finite null statistic"
          },
          {
            "x": "-3/10",
            "y": "529/541",
            "series": "Finite null statistic"
          },
          {
            "x": "-1/5",
            "y": "121/119",
            "series": "Finite null statistic"
          },
          {
            "x": "-1/10",
            "y": "147/143",
            "series": "Finite null statistic"
          },
          {
            "x": "0",
            "y": "1",
            "series": "Finite null statistic"
          },
          {
            "x": "1/10",
            "y": "361/389",
            "series": "Finite null statistic"
          },
          {
            "x": "1/5",
            "y": "9/11",
            "series": "Finite null statistic"
          },
          {
            "x": "3/10",
            "y": "289/421",
            "series": "Finite null statistic"
          },
          {
            "x": "2/5",
            "y": "16/29",
            "series": "Finite null statistic"
          },
          {
            "x": "1/2",
            "y": "3/7",
            "series": "Finite null statistic"
          },
          {
            "x": "3/5",
            "y": "49/151",
            "series": "Finite null statistic"
          },
          {
            "x": "7/10",
            "y": "169/701",
            "series": "Finite null statistic"
          },
          {
            "x": "4/5",
            "y": "3/17",
            "series": "Finite null statistic"
          },
          {
            "x": "9/10",
            "y": "121/949",
            "series": "Finite null statistic"
          },
          {
            "x": "1",
            "y": "1/11",
            "series": "Finite null statistic"
          },
          {
            "x": "11/10",
            "y": "3/47",
            "series": "Finite null statistic"
          },
          {
            "x": "6/5",
            "y": "4/91",
            "series": "Finite null statistic"
          },
          {
            "x": "13/10",
            "y": "49/1661",
            "series": "Finite null statistic"
          },
          {
            "x": "7/5",
            "y": "3/157",
            "series": "Finite null statistic"
          },
          {
            "x": "3/2",
            "y": "1/85",
            "series": "Finite null statistic"
          },
          {
            "x": "8/5",
            "y": "1/149",
            "series": "Finite null statistic"
          },
          {
            "x": "17/10",
            "y": "3/887",
            "series": "Finite null statistic"
          },
          {
            "x": "9/5",
            "y": "1/739",
            "series": "Finite null statistic"
          },
          {
            "x": "19/10",
            "y": "1/3269",
            "series": "Finite null statistic"
          },
          {
            "x": "2",
            "y": "0",
            "series": "Finite null statistic"
          },
          {
            "x": "21/10",
            "y": "1/3949",
            "series": "Finite null statistic"
          },
          {
            "x": "11/5",
            "y": "1/1079",
            "series": "Finite null statistic"
          },
          {
            "x": "23/10",
            "y": "3/1567",
            "series": "Finite null statistic"
          },
          {
            "x": "12/5",
            "y": "1/319",
            "series": "Finite null statistic"
          },
          {
            "x": "5/2",
            "y": "1/221",
            "series": "Finite null statistic"
          },
          {
            "x": "13/5",
            "y": "3/497",
            "series": "Finite null statistic"
          },
          {
            "x": "27/10",
            "y": "49/6421",
            "series": "Finite null statistic"
          },
          {
            "x": "14/5",
            "y": "4/431",
            "series": "Finite null statistic"
          },
          {
            "x": "29/10",
            "y": "9/821",
            "series": "Finite null statistic"
          },
          {
            "x": "3",
            "y": "1/79",
            "series": "Finite null statistic"
          },
          {
            "x": "31/10",
            "y": "121/8429",
            "series": "Finite null statistic"
          },
          {
            "x": "16/5",
            "y": "3/187",
            "series": "Finite null statistic"
          },
          {
            "x": "33/10",
            "y": "169/9541",
            "series": "Finite null statistic"
          },
          {
            "x": "17/5",
            "y": "49/2531",
            "series": "Finite null statistic"
          },
          {
            "x": "7/2",
            "y": "3/143",
            "series": "Finite null statistic"
          },
          {
            "x": "18/5",
            "y": "16/709",
            "series": "Finite null statistic"
          },
          {
            "x": "37/10",
            "y": "289/11981",
            "series": "Finite null statistic"
          },
          {
            "x": "19/5",
            "y": "1/39",
            "series": "Finite null statistic"
          },
          {
            "x": "39/10",
            "y": "361/13309",
            "series": "Finite null statistic"
          },
          {
            "x": "4",
            "y": "1/35",
            "series": "Finite null statistic"
          },
          {
            "x": "41/10",
            "y": "147/4903",
            "series": "Finite null statistic"
          },
          {
            "x": "21/5",
            "y": "121/3859",
            "series": "Finite null statistic"
          },
          {
            "x": "43/10",
            "y": "529/16181",
            "series": "Finite null statistic"
          },
          {
            "x": "22/5",
            "y": "12/353",
            "series": "Finite null statistic"
          },
          {
            "x": "9/2",
            "y": "25/709",
            "series": "Finite null statistic"
          },
          {
            "x": "23/5",
            "y": "169/4631",
            "series": "Finite null statistic"
          },
          {
            "x": "47/10",
            "y": "81/2149",
            "series": "Finite null statistic"
          },
          {
            "x": "24/5",
            "y": "49/1261",
            "series": "Finite null statistic"
          },
          {
            "x": "49/10",
            "y": "841/21029",
            "series": "Finite null statistic"
          },
          {
            "x": "5",
            "y": "3/73",
            "series": "Finite null statistic"
          },
          {
            "x": "51/10",
            "y": "961/22789",
            "series": "Finite null statistic"
          },
          {
            "x": "26/5",
            "y": "64/1481",
            "series": "Finite null statistic"
          },
          {
            "x": "53/10",
            "y": "363/8207",
            "series": "Finite null statistic"
          },
          {
            "x": "27/5",
            "y": "289/6391",
            "series": "Finite null statistic"
          },
          {
            "x": "11/2",
            "y": "49/1061",
            "series": "Finite null statistic"
          },
          {
            "x": "28/5",
            "y": "9/191",
            "series": "Finite null statistic"
          },
          {
            "x": "57/10",
            "y": "1369/28501",
            "series": "Finite null statistic"
          },
          {
            "x": "29/5",
            "y": "361/7379",
            "series": "Finite null statistic"
          },
          {
            "x": "59/10",
            "y": "507/10183",
            "series": "Finite null statistic"
          },
          {
            "x": "6",
            "y": "4/79",
            "series": "Finite null statistic"
          },
          {
            "x": "61/10",
            "y": "1681/32669",
            "series": "Finite null statistic"
          },
          {
            "x": "31/5",
            "y": "147/2813",
            "series": "Finite null statistic"
          },
          {
            "x": "63/10",
            "y": "1849/34861",
            "series": "Finite null statistic"
          },
          {
            "x": "32/5",
            "y": "121/2249",
            "series": "Finite null statistic"
          },
          {
            "x": "13/2",
            "y": "3/55",
            "series": "Finite null statistic"
          },
          {
            "x": "33/5",
            "y": "529/9571",
            "series": "Finite null statistic"
          },
          {
            "x": "67/10",
            "y": "2209/39461",
            "series": "Finite null statistic"
          },
          {
            "x": "34/5",
            "y": "48/847",
            "series": "Finite null statistic"
          },
          {
            "x": "69/10",
            "y": "2401/41869",
            "series": "Finite null statistic"
          },
          {
            "x": "7",
            "y": "25/431",
            "series": "Finite null statistic"
          },
          {
            "x": "71/10",
            "y": "867/14783",
            "series": "Finite null statistic"
          },
          {
            "x": "36/5",
            "y": "169/2851",
            "series": "Finite null statistic"
          },
          {
            "x": "73/10",
            "y": "2809/46901",
            "series": "Finite null statistic"
          },
          {
            "x": "37/5",
            "y": "81/1339",
            "series": "Finite null statistic"
          },
          {
            "x": "15/2",
            "y": "121/1981",
            "series": "Finite null statistic"
          },
          {
            "x": "38/5",
            "y": "196/3179",
            "series": "Finite null statistic"
          },
          {
            "x": "77/10",
            "y": "1083/17407",
            "series": "Finite null statistic"
          },
          {
            "x": "39/5",
            "y": "841/13399",
            "series": "Finite null statistic"
          },
          {
            "x": "79/10",
            "y": "3481/54989",
            "series": "Finite null statistic"
          },
          {
            "x": "8",
            "y": "3/47",
            "series": "Finite null statistic"
          }
        ],
        "plotFile": "metr18-fixed-results/ar-known-normal-slopes-python/plot.svg",
        "plotSHA256": "2513b455c59cfaaee0226669259747afd3ac750acbec3546f36d597524ace0e4",
        "files": [
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-python/full.json",
            "sha256": "64e385736603215a9d49acf19ff80c2e7efdb804d4f675cc3e144d070589e7c7"
          },
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-python/plot-points.csv",
            "sha256": "3557bb456d0dadf914a2588113558e71e13a40b284685866786c2de6bb5d93be"
          },
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-python/plot.svg",
            "sha256": "2513b455c59cfaaee0226669259747afd3ac750acbec3546f36d597524ace0e4"
          },
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-python/summary.csv",
            "sha256": "8d37a8ae83affdf560fded563e98b9fd05571e676684d9ac69a1c3bb584867c6"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "zero-null-variance": {
        "api": "ar",
        "variant": "zero-null-variance",
        "language": "python",
        "codeFile": "metr18-code/ar-zero-null-variance.py",
        "codeSHA256": "1388a918f01f83ace5d4e586167e78433fd97a3de124068f0221c3012639e39d",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='ar'\nINPUT={'delta': '3/2', 'pi': '1/2', 'covariance': [['1/16', '1/16'], ['1/16', '1/16']], 'beta0': '1', 'criticalValue': '4', 'gridLow': '-2', 'gridHigh': '6'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='ar'\nINPUT={'delta': '3/2', 'pi': '1/2', 'covariance': [['1/16', '1/16'], ['1/16', '1/16']], 'beta0': '1', 'criticalValue': '4', 'gridLow': '-2', 'gridHigh': '6'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "3/2",
          "pi": "1/2",
          "covariance": [
            [
              "1/16",
              "1/16"
            ],
            [
              "1/16",
              "1/16"
            ]
          ],
          "beta0": "1",
          "criticalValue": "4",
          "gridLow": "-2",
          "gridHigh": "6"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta0=1.000000000, nullMoment=1.000000000, nullVariance=0.000000000, statistic=undefined, positiveInfinity=1.000000000, zeroOverZero=0.000000000, nonrejected=0.000000000\r\n",
        "stderr": "",
        "summary": {
          "beta0": "1.000000000",
          "nullMoment": "1.000000000",
          "nullVariance": "0.000000000",
          "statistic": "undefined",
          "positiveInfinity": "1.000000000",
          "zeroOverZero": "0.000000000",
          "nonrejected": "0.000000000"
        },
        "plotPoints": [
          {
            "x": "-2",
            "y": "100/9",
            "series": "Finite null statistic"
          },
          {
            "x": "-29/15",
            "y": "1369/121",
            "series": "Finite null statistic"
          },
          {
            "x": "-28/15",
            "y": "21316/1849",
            "series": "Finite null statistic"
          },
          {
            "x": "-9/5",
            "y": "576/49",
            "series": "Finite null statistic"
          },
          {
            "x": "-26/15",
            "y": "20164/1681",
            "series": "Finite null statistic"
          },
          {
            "x": "-5/3",
            "y": "49/4",
            "series": "Finite null statistic"
          },
          {
            "x": "-8/5",
            "y": "2116/169",
            "series": "Finite null statistic"
          },
          {
            "x": "-23/15",
            "y": "4624/361",
            "series": "Finite null statistic"
          },
          {
            "x": "-22/15",
            "y": "17956/1369",
            "series": "Finite null statistic"
          },
          {
            "x": "-7/5",
            "y": "121/9",
            "series": "Finite null statistic"
          },
          {
            "x": "-4/3",
            "y": "676/49",
            "series": "Finite null statistic"
          },
          {
            "x": "-19/15",
            "y": "4096/289",
            "series": "Finite null statistic"
          },
          {
            "x": "-6/5",
            "y": "1764/121",
            "series": "Finite null statistic"
          },
          {
            "x": "-17/15",
            "y": "961/64",
            "series": "Finite null statistic"
          },
          {
            "x": "-16/15",
            "y": "14884/961",
            "series": "Finite null statistic"
          },
          {
            "x": "-1",
            "y": "16",
            "series": "Finite null statistic"
          },
          {
            "x": "-14/15",
            "y": "13924/841",
            "series": "Finite null statistic"
          },
          {
            "x": "-13/15",
            "y": "841/49",
            "series": "Finite null statistic"
          },
          {
            "x": "-4/5",
            "y": "1444/81",
            "series": "Finite null statistic"
          },
          {
            "x": "-11/15",
            "y": "3136/169",
            "series": "Finite null statistic"
          },
          {
            "x": "-2/3",
            "y": "484/25",
            "series": "Finite null statistic"
          },
          {
            "x": "-3/5",
            "y": "81/4",
            "series": "Finite null statistic"
          },
          {
            "x": "-8/15",
            "y": "11236/529",
            "series": "Finite null statistic"
          },
          {
            "x": "-7/15",
            "y": "2704/121",
            "series": "Finite null statistic"
          },
          {
            "x": "-2/5",
            "y": "1156/49",
            "series": "Finite null statistic"
          },
          {
            "x": "-1/3",
            "y": "25",
            "series": "Finite null statistic"
          },
          {
            "x": "-4/15",
            "y": "9604/361",
            "series": "Finite null statistic"
          },
          {
            "x": "-1/5",
            "y": "256/9",
            "series": "Finite null statistic"
          },
          {
            "x": "-2/15",
            "y": "8836/289",
            "series": "Finite null statistic"
          },
          {
            "x": "-1/15",
            "y": "529/16",
            "series": "Finite null statistic"
          },
          {
            "x": "0",
            "y": "36",
            "series": "Finite null statistic"
          },
          {
            "x": "1/15",
            "y": "1936/49",
            "series": "Finite null statistic"
          },
          {
            "x": "2/15",
            "y": "7396/169",
            "series": "Finite null statistic"
          },
          {
            "x": "1/5",
            "y": "49",
            "series": "Finite null statistic"
          },
          {
            "x": "4/15",
            "y": "6724/121",
            "series": "Finite null statistic"
          },
          {
            "x": "1/3",
            "y": "64",
            "series": "Finite null statistic"
          },
          {
            "x": "2/5",
            "y": "676/9",
            "series": "Finite null statistic"
          },
          {
            "x": "7/15",
            "y": "361/4",
            "series": "Finite null statistic"
          },
          {
            "x": "8/15",
            "y": "5476/49",
            "series": "Finite null statistic"
          },
          {
            "x": "3/5",
            "y": "144",
            "series": "Finite null statistic"
          },
          {
            "x": "2/3",
            "y": "196",
            "series": "Finite null statistic"
          },
          {
            "x": "11/15",
            "y": "289",
            "series": "Finite null statistic"
          },
          {
            "x": "4/5",
            "y": "484",
            "series": "Finite null statistic"
          },
          {
            "x": "13/15",
            "y": "1024",
            "series": "Finite null statistic"
          },
          {
            "x": "14/15",
            "y": "3844",
            "series": "Finite null statistic"
          },
          {
            "x": "1",
            "y": "",
            "series": "Finite null statistic"
          },
          {
            "x": "16/15",
            "y": "3364",
            "series": "Finite null statistic"
          },
          {
            "x": "17/15",
            "y": "784",
            "series": "Finite null statistic"
          },
          {
            "x": "6/5",
            "y": "324",
            "series": "Finite null statistic"
          },
          {
            "x": "19/15",
            "y": "169",
            "series": "Finite null statistic"
          },
          {
            "x": "4/3",
            "y": "100",
            "series": "Finite null statistic"
          },
          {
            "x": "7/5",
            "y": "64",
            "series": "Finite null statistic"
          },
          {
            "x": "22/15",
            "y": "2116/49",
            "series": "Finite null statistic"
          },
          {
            "x": "23/15",
            "y": "121/4",
            "series": "Finite null statistic"
          },
          {
            "x": "8/5",
            "y": "196/9",
            "series": "Finite null statistic"
          },
          {
            "x": "5/3",
            "y": "16",
            "series": "Finite null statistic"
          },
          {
            "x": "26/15",
            "y": "1444/121",
            "series": "Finite null statistic"
          },
          {
            "x": "9/5",
            "y": "9",
            "series": "Finite null statistic"
          },
          {
            "x": "28/15",
            "y": "1156/169",
            "series": "Finite null statistic"
          },
          {
            "x": "29/15",
            "y": "256/49",
            "series": "Finite null statistic"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Finite null statistic"
          },
          {
            "x": "31/15",
            "y": "49/16",
            "series": "Finite null statistic"
          },
          {
            "x": "32/15",
            "y": "676/289",
            "series": "Finite null statistic"
          },
          {
            "x": "11/5",
            "y": "16/9",
            "series": "Finite null statistic"
          },
          {
            "x": "34/15",
            "y": "484/361",
            "series": "Finite null statistic"
          },
          {
            "x": "7/3",
            "y": "1",
            "series": "Finite null statistic"
          },
          {
            "x": "12/5",
            "y": "36/49",
            "series": "Finite null statistic"
          },
          {
            "x": "37/15",
            "y": "64/121",
            "series": "Finite null statistic"
          },
          {
            "x": "38/15",
            "y": "196/529",
            "series": "Finite null statistic"
          },
          {
            "x": "13/5",
            "y": "1/4",
            "series": "Finite null statistic"
          },
          {
            "x": "8/3",
            "y": "4/25",
            "series": "Finite null statistic"
          },
          {
            "x": "41/15",
            "y": "16/169",
            "series": "Finite null statistic"
          },
          {
            "x": "14/5",
            "y": "4/81",
            "series": "Finite null statistic"
          },
          {
            "x": "43/15",
            "y": "1/49",
            "series": "Finite null statistic"
          },
          {
            "x": "44/15",
            "y": "4/841",
            "series": "Finite null statistic"
          },
          {
            "x": "3",
            "y": "0",
            "series": "Finite null statistic"
          },
          {
            "x": "46/15",
            "y": "4/961",
            "series": "Finite null statistic"
          },
          {
            "x": "47/15",
            "y": "1/64",
            "series": "Finite null statistic"
          },
          {
            "x": "16/5",
            "y": "4/121",
            "series": "Finite null statistic"
          },
          {
            "x": "49/15",
            "y": "16/289",
            "series": "Finite null statistic"
          },
          {
            "x": "10/3",
            "y": "4/49",
            "series": "Finite null statistic"
          },
          {
            "x": "17/5",
            "y": "1/9",
            "series": "Finite null statistic"
          },
          {
            "x": "52/15",
            "y": "196/1369",
            "series": "Finite null statistic"
          },
          {
            "x": "53/15",
            "y": "64/361",
            "series": "Finite null statistic"
          },
          {
            "x": "18/5",
            "y": "36/169",
            "series": "Finite null statistic"
          },
          {
            "x": "11/3",
            "y": "1/4",
            "series": "Finite null statistic"
          },
          {
            "x": "56/15",
            "y": "484/1681",
            "series": "Finite null statistic"
          },
          {
            "x": "19/5",
            "y": "16/49",
            "series": "Finite null statistic"
          },
          {
            "x": "58/15",
            "y": "676/1849",
            "series": "Finite null statistic"
          },
          {
            "x": "59/15",
            "y": "49/121",
            "series": "Finite null statistic"
          },
          {
            "x": "4",
            "y": "4/9",
            "series": "Finite null statistic"
          },
          {
            "x": "61/15",
            "y": "256/529",
            "series": "Finite null statistic"
          },
          {
            "x": "62/15",
            "y": "1156/2209",
            "series": "Finite null statistic"
          },
          {
            "x": "21/5",
            "y": "9/16",
            "series": "Finite null statistic"
          },
          {
            "x": "64/15",
            "y": "1444/2401",
            "series": "Finite null statistic"
          },
          {
            "x": "13/3",
            "y": "16/25",
            "series": "Finite null statistic"
          },
          {
            "x": "22/5",
            "y": "196/289",
            "series": "Finite null statistic"
          },
          {
            "x": "67/15",
            "y": "121/169",
            "series": "Finite null statistic"
          },
          {
            "x": "68/15",
            "y": "2116/2809",
            "series": "Finite null statistic"
          },
          {
            "x": "23/5",
            "y": "64/81",
            "series": "Finite null statistic"
          },
          {
            "x": "14/3",
            "y": "100/121",
            "series": "Finite null statistic"
          },
          {
            "x": "71/15",
            "y": "169/196",
            "series": "Finite null statistic"
          },
          {
            "x": "24/5",
            "y": "324/361",
            "series": "Finite null statistic"
          },
          {
            "x": "73/15",
            "y": "784/841",
            "series": "Finite null statistic"
          },
          {
            "x": "74/15",
            "y": "3364/3481",
            "series": "Finite null statistic"
          },
          {
            "x": "5",
            "y": "1",
            "series": "Finite null statistic"
          },
          {
            "x": "76/15",
            "y": "3844/3721",
            "series": "Finite null statistic"
          },
          {
            "x": "77/15",
            "y": "1024/961",
            "series": "Finite null statistic"
          },
          {
            "x": "26/5",
            "y": "484/441",
            "series": "Finite null statistic"
          },
          {
            "x": "79/15",
            "y": "289/256",
            "series": "Finite null statistic"
          },
          {
            "x": "16/3",
            "y": "196/169",
            "series": "Finite null statistic"
          },
          {
            "x": "27/5",
            "y": "144/121",
            "series": "Finite null statistic"
          },
          {
            "x": "82/15",
            "y": "5476/4489",
            "series": "Finite null statistic"
          },
          {
            "x": "83/15",
            "y": "361/289",
            "series": "Finite null statistic"
          },
          {
            "x": "28/5",
            "y": "676/529",
            "series": "Finite null statistic"
          },
          {
            "x": "17/3",
            "y": "64/49",
            "series": "Finite null statistic"
          },
          {
            "x": "86/15",
            "y": "6724/5041",
            "series": "Finite null statistic"
          },
          {
            "x": "29/5",
            "y": "49/36",
            "series": "Finite null statistic"
          },
          {
            "x": "88/15",
            "y": "7396/5329",
            "series": "Finite null statistic"
          },
          {
            "x": "89/15",
            "y": "1936/1369",
            "series": "Finite null statistic"
          },
          {
            "x": "6",
            "y": "36/25",
            "series": "Finite null statistic"
          }
        ],
        "plotFile": "metr18-fixed-results/ar-zero-null-variance-python/plot.svg",
        "plotSHA256": "0ab4ad2bead0559571699776d874c780320a25e3c28517eda840963f663e7a82",
        "files": [
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-python/full.json",
            "sha256": "ae7572a4cdb2c5cdd23446b8c9c3cfc0271ecd05c795c12ba51630074a1e20d2"
          },
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-python/plot-points.csv",
            "sha256": "8e44b69c4bebbcb145af9f5b5b75fc7a33d54ba5ae3c20f5795570145f145ba2"
          },
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-python/plot.svg",
            "sha256": "0ab4ad2bead0559571699776d874c780320a25e3c28517eda840963f663e7a82"
          },
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-python/summary.csv",
            "sha256": "8b24735670fa9f225c63c8dd300ed5952e08368d4127aaacd78c8e2f09ef9e02"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    },
    "r": {
      "known-normal-slopes": {
        "api": "ar",
        "variant": "known-normal-slopes",
        "language": "r",
        "codeFile": "metr18-code/ar-known-normal-slopes.R",
        "codeSHA256": "96320c9706572eab4e2e6c9995cc324fa2c41efac3bdc0b0d9350058901ac0ca",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"ar\"\nINPUT=list(delta=\"1/5\",pi=\"1/10\",covariance=list(list(\"1/25\",\"1/100\"),list(\"1/100\",\"9/100\")),beta0=\"2\",criticalValue=\"4\",gridLow=\"-4\",gridHigh=\"8\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"ar\"\nINPUT=list(delta=\"1/5\",pi=\"1/10\",covariance=list(list(\"1/25\",\"1/100\"),list(\"1/100\",\"9/100\")),beta0=\"2\",criticalValue=\"4\",gridLow=\"-4\",gridHigh=\"8\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "1/5",
          "pi": "1/10",
          "covariance": [
            [
              "1/25",
              "1/100"
            ],
            [
              "1/100",
              "9/100"
            ]
          ],
          "beta0": "2",
          "criticalValue": "4",
          "gridLow": "-4",
          "gridHigh": "8"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta0=2.000000000, nullMoment=0.000000000, nullVariance=0.360000000, statistic=0.000000000, positiveInfinity=0.000000000, zeroOverZero=0.000000000, nonrejected=1.000000000 \r\n",
        "stderr": "",
        "summary": {
          "beta0": "2.000000000",
          "nullMoment": "0.000000000",
          "nullVariance": "0.360000000",
          "statistic": "0.000000000",
          "positiveInfinity": "0.000000000",
          "zeroOverZero": "0.000000000",
          "nonrejected": "1.000000000"
        },
        "plotPoints": [
          {
            "x": "-4",
            "y": "0.23076923076923084",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.8999999999999999",
            "y": "0.23411123814647933",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.7999999999999998",
            "y": "0.23763775077705573",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.7000000000000002",
            "y": "0.24136394027189664",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.6000000000000001",
            "y": "0.24530663329161451",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.5",
            "y": "0.24948453608247423",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.3999999999999999",
            "y": "0.25391849529780569",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.2999999999999998",
            "y": "0.25863180185986567",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.2000000000000002",
            "y": "0.26365054602184085",
            "series": "Finite null statistic"
          },
          {
            "x": "-3.1000000000000001",
            "y": "0.26900403350915292",
            "series": "Finite null statistic"
          },
          {
            "x": "-3",
            "y": "0.27472527472527475",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.8999999999999999",
            "y": "0.28085156158615043",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.7999999999999998",
            "y": "0.28742514970059885",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.7000000000000002",
            "y": "0.29449406745767237",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.6000000000000001",
            "y": "0.30211307824100514",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.5",
            "y": "0.31034482758620691",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.3999999999999999",
            "y": "0.31926121372031663",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.2999999999999998",
            "y": "0.32894502757516458",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.2000000000000002",
            "y": "0.33949191685912244",
            "series": "Finite null statistic"
          },
          {
            "x": "-2.1000000000000001",
            "y": "0.35101273752349138",
            "series": "Finite null statistic"
          },
          {
            "x": "-2",
            "y": "0.3636363636363637",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.8999999999999999",
            "y": "0.37751303052866719",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.7999999999999998",
            "y": "0.3928182807399348",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.7000000000000002",
            "y": "0.40975755761747984",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.6000000000000001",
            "y": "0.42857142857142855",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.5",
            "y": "0.44954128440366986",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.3999999999999999",
            "y": "0.47299509001636658",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.2999999999999998",
            "y": "0.49931224209078401",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.2000000000000002",
            "y": "0.52892561983471087",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.1000000000000001",
            "y": "0.56231714452896453",
            "series": "Finite null statistic"
          },
          {
            "x": "-1",
            "y": "0.6000000000000002",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.89999999999999991",
            "y": "0.64247517188693692",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.79999999999999982",
            "y": "0.69014084507042284",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.70000000000000018",
            "y": "0.74311926605504575",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.60000000000000009",
            "y": "0.80094786729857825",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.5",
            "y": "0.86206896551724133",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.39999999999999991",
            "y": "0.92307692307692313",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.29999999999999982",
            "y": "0.97781885397412205",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.20000000000000018",
            "y": "1.0168067226890756",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.10000000000000009",
            "y": "1.0279720279720279",
            "series": "Finite null statistic"
          },
          {
            "x": "0",
            "y": "1.0000000000000002",
            "series": "Finite null statistic"
          },
          {
            "x": "0.099999999999999645",
            "y": "0.92802056555269985",
            "series": "Finite null statistic"
          },
          {
            "x": "0.20000000000000018",
            "y": "0.81818181818181812",
            "series": "Finite null statistic"
          },
          {
            "x": "0.29999999999999982",
            "y": "0.68646080760095052",
            "series": "Finite null statistic"
          },
          {
            "x": "0.40000000000000036",
            "y": "0.55172413793103403",
            "series": "Finite null statistic"
          },
          {
            "x": "0.5",
            "y": "0.42857142857142871",
            "series": "Finite null statistic"
          },
          {
            "x": "0.59999999999999964",
            "y": "0.32450331125827847",
            "series": "Finite null statistic"
          },
          {
            "x": "0.70000000000000018",
            "y": "0.24108416547788866",
            "series": "Finite null statistic"
          },
          {
            "x": "0.79999999999999982",
            "y": "0.17647058823529421",
            "series": "Finite null statistic"
          },
          {
            "x": "0.90000000000000036",
            "y": "0.12750263435194931",
            "series": "Finite null statistic"
          },
          {
            "x": "1",
            "y": "0.090909090909090925",
            "series": "Finite null statistic"
          },
          {
            "x": "1.0999999999999996",
            "y": "0.063829787234042645",
            "series": "Finite null statistic"
          },
          {
            "x": "1.2000000000000002",
            "y": "0.043956043956043939",
            "series": "Finite null statistic"
          },
          {
            "x": "1.2999999999999998",
            "y": "0.029500301023479867",
            "series": "Finite null statistic"
          },
          {
            "x": "1.4000000000000004",
            "y": "0.019108280254777045",
            "series": "Finite null statistic"
          },
          {
            "x": "1.5",
            "y": "0.011764705882352936",
            "series": "Finite null statistic"
          },
          {
            "x": "1.5999999999999996",
            "y": "0.0067114093959731698",
            "series": "Finite null statistic"
          },
          {
            "x": "1.7000000000000002",
            "y": "0.0033821871476888313",
            "series": "Finite null statistic"
          },
          {
            "x": "1.7999999999999998",
            "y": "0.0013531799729364035",
            "series": "Finite null statistic"
          },
          {
            "x": "1.9000000000000004",
            "y": "0.00030590394616090256",
            "series": "Finite null statistic"
          },
          {
            "x": "2",
            "y": "0",
            "series": "Finite null statistic"
          },
          {
            "x": "2.0999999999999996",
            "y": "0.00025322866548493065",
            "series": "Finite null statistic"
          },
          {
            "x": "2.2000000000000002",
            "y": "0.00092678405931418144",
            "series": "Finite null statistic"
          },
          {
            "x": "2.2999999999999998",
            "y": "0.0019144862795149934",
            "series": "Finite null statistic"
          },
          {
            "x": "2.4000000000000004",
            "y": "0.0031347962382445192",
            "series": "Finite null statistic"
          },
          {
            "x": "2.5",
            "y": "0.0045248868778280521",
            "series": "Finite null statistic"
          },
          {
            "x": "2.5999999999999996",
            "y": "0.0060362173038229277",
            "series": "Finite null statistic"
          },
          {
            "x": "2.7000000000000002",
            "y": "0.0076312100918859999",
            "series": "Finite null statistic"
          },
          {
            "x": "2.7999999999999998",
            "y": "0.0092807424593967444",
            "series": "Finite null statistic"
          },
          {
            "x": "2.9000000000000004",
            "y": "0.01096224116930573",
            "series": "Finite null statistic"
          },
          {
            "x": "3",
            "y": "0.012658227848101276",
            "series": "Finite null statistic"
          },
          {
            "x": "3.0999999999999996",
            "y": "0.01435520227785028",
            "series": "Finite null statistic"
          },
          {
            "x": "3.2000000000000002",
            "y": "0.01604278074866311",
            "series": "Finite null statistic"
          },
          {
            "x": "3.2999999999999998",
            "y": "0.017713027984488004",
            "series": "Finite null statistic"
          },
          {
            "x": "3.4000000000000004",
            "y": "0.019359936783879907",
            "series": "Finite null statistic"
          },
          {
            "x": "3.5",
            "y": "0.020979020979020983",
            "series": "Finite null statistic"
          },
          {
            "x": "3.5999999999999996",
            "y": "0.022566995768688293",
            "series": "Finite null statistic"
          },
          {
            "x": "3.7000000000000002",
            "y": "0.024121525749102757",
            "series": "Finite null statistic"
          },
          {
            "x": "3.7999999999999998",
            "y": "0.025641025641025644",
            "series": "Finite null statistic"
          },
          {
            "x": "3.9000000000000004",
            "y": "0.027124502216545207",
            "series": "Finite null statistic"
          },
          {
            "x": "4",
            "y": "0.028571428571428577",
            "series": "Finite null statistic"
          },
          {
            "x": "4.0999999999999996",
            "y": "0.029981643891494995",
            "series": "Finite null statistic"
          },
          {
            "x": "4.1999999999999993",
            "y": "0.031355273386887782",
            "series": "Finite null statistic"
          },
          {
            "x": "4.3000000000000007",
            "y": "0.03269266423583217",
            "series": "Finite null statistic"
          },
          {
            "x": "4.4000000000000004",
            "y": "0.033994334277620407",
            "series": "Finite null statistic"
          },
          {
            "x": "4.5",
            "y": "0.035260930888575459",
            "series": "Finite null statistic"
          },
          {
            "x": "4.5999999999999996",
            "y": "0.036493198013388031",
            "series": "Finite null statistic"
          },
          {
            "x": "4.6999999999999993",
            "y": "0.037691949744067012",
            "series": "Finite null statistic"
          },
          {
            "x": "4.8000000000000007",
            "y": "0.038858049167327532",
            "series": "Finite null statistic"
          },
          {
            "x": "4.9000000000000004",
            "y": "0.03999239145941319",
            "series": "Finite null statistic"
          },
          {
            "x": "5",
            "y": "0.041095890410958902",
            "series": "Finite null statistic"
          },
          {
            "x": "5.0999999999999996",
            "y": "0.04216946772565712",
            "series": "Finite null statistic"
          },
          {
            "x": "5.1999999999999993",
            "y": "0.043214044564483446",
            "series": "Finite null statistic"
          },
          {
            "x": "5.3000000000000007",
            "y": "0.044230534909223851",
            "series": "Finite null statistic"
          },
          {
            "x": "5.4000000000000004",
            "y": "0.045219840400563302",
            "series": "Finite null statistic"
          },
          {
            "x": "5.5",
            "y": "0.046182846371347799",
            "series": "Finite null statistic"
          },
          {
            "x": "5.5999999999999996",
            "y": "0.047120418848167527",
            "series": "Finite null statistic"
          },
          {
            "x": "5.6999999999999993",
            "y": "0.048033402336760109",
            "series": "Finite null statistic"
          },
          {
            "x": "5.8000000000000007",
            "y": "0.04892261824095407",
            "series": "Finite null statistic"
          },
          {
            "x": "5.9000000000000004",
            "y": "0.049788863792595513",
            "series": "Finite null statistic"
          },
          {
            "x": "6",
            "y": "0.050632911392405083",
            "series": "Finite null statistic"
          },
          {
            "x": "6.0999999999999996",
            "y": "0.051455508280020816",
            "series": "Finite null statistic"
          },
          {
            "x": "6.1999999999999993",
            "y": "0.052257376466405978",
            "series": "Finite null statistic"
          },
          {
            "x": "6.3000000000000007",
            "y": "0.053039212873985261",
            "series": "Finite null statistic"
          },
          {
            "x": "6.4000000000000004",
            "y": "0.053801689639839945",
            "series": "Finite null statistic"
          },
          {
            "x": "6.5",
            "y": "0.05454545454545455",
            "series": "Finite null statistic"
          },
          {
            "x": "6.5999999999999996",
            "y": "0.055271131543203442",
            "series": "Finite null statistic"
          },
          {
            "x": "6.6999999999999993",
            "y": "0.055979321355262152",
            "series": "Finite null statistic"
          },
          {
            "x": "6.8000000000000007",
            "y": "0.056670602125147601",
            "series": "Finite null statistic"
          },
          {
            "x": "6.9000000000000004",
            "y": "0.05734553010580621",
            "series": "Finite null statistic"
          },
          {
            "x": "7",
            "y": "0.058004640371229689",
            "series": "Finite null statistic"
          },
          {
            "x": "7.0999999999999996",
            "y": "0.058648447541094516",
            "series": "Finite null statistic"
          },
          {
            "x": "7.1999999999999993",
            "y": "0.059277446509996515",
            "series": "Finite null statistic"
          },
          {
            "x": "7.3000000000000007",
            "y": "0.059892113174559169",
            "series": "Finite null statistic"
          },
          {
            "x": "7.4000000000000004",
            "y": "0.060492905153099331",
            "series": "Finite null statistic"
          },
          {
            "x": "7.5",
            "y": "0.061080262493690071",
            "series": "Finite null statistic"
          },
          {
            "x": "7.5999999999999996",
            "y": "0.06165460836741115",
            "series": "Finite null statistic"
          },
          {
            "x": "7.6999999999999993",
            "y": "0.062216349744355741",
            "series": "Finite null statistic"
          },
          {
            "x": "7.8000000000000007",
            "y": "0.062765878050600798",
            "series": "Finite null statistic"
          },
          {
            "x": "7.9000000000000004",
            "y": "0.063303569804870077",
            "series": "Finite null statistic"
          },
          {
            "x": "8",
            "y": "0.063829787234042576",
            "series": "Finite null statistic"
          }
        ],
        "plotFile": "metr18-fixed-results/ar-known-normal-slopes-r/plot.svg",
        "plotSHA256": "0fdea2ca97f6d349f63f4f0fc57f1b6706118a1e1cc6e282ebd6862e50173860",
        "files": [
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-r/full-result.Rtext",
            "sha256": "e5a33e48e83d484227cbcb926d1863d223bc8a80a5394f91edb7f2d327c76b67"
          },
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-r/plot-points.csv",
            "sha256": "bbaabc1c841a40bd6c0f63db6664c138a6116c59d13cda4649a0d2908e9f90f4"
          },
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-r/plot.svg",
            "sha256": "0fdea2ca97f6d349f63f4f0fc57f1b6706118a1e1cc6e282ebd6862e50173860"
          },
          {
            "file": "metr18-fixed-results/ar-known-normal-slopes-r/summary.csv",
            "sha256": "4fadeee591c71502b63f7ee4103745e2ef4394110560ef03ea116992f99f2786"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "zero-null-variance": {
        "api": "ar",
        "variant": "zero-null-variance",
        "language": "r",
        "codeFile": "metr18-code/ar-zero-null-variance.R",
        "codeSHA256": "60296ec1aabba0f67ff48c844e9087777db30167c60b4ebe405ea85824441282",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"ar\"\nINPUT=list(delta=\"3/2\",pi=\"1/2\",covariance=list(list(\"1/16\",\"1/16\"),list(\"1/16\",\"1/16\")),beta0=\"1\",criticalValue=\"4\",gridLow=\"-2\",gridHigh=\"6\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"ar\"\nINPUT=list(delta=\"3/2\",pi=\"1/2\",covariance=list(list(\"1/16\",\"1/16\"),list(\"1/16\",\"1/16\")),beta0=\"1\",criticalValue=\"4\",gridLow=\"-2\",gridHigh=\"6\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "3/2",
          "pi": "1/2",
          "covariance": [
            [
              "1/16",
              "1/16"
            ],
            [
              "1/16",
              "1/16"
            ]
          ],
          "beta0": "1",
          "criticalValue": "4",
          "gridLow": "-2",
          "gridHigh": "6"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta0=1.000000000, nullMoment=1.000000000, nullVariance=0.000000000, statistic=undefined, positiveInfinity=1.000000000, zeroOverZero=0.000000000, nonrejected=0.000000000 \r\n",
        "stderr": "",
        "summary": {
          "beta0": "1.000000000",
          "nullMoment": "1.000000000",
          "nullVariance": "0.000000000",
          "statistic": "undefined",
          "positiveInfinity": "1.000000000",
          "zeroOverZero": "0.000000000",
          "nonrejected": "0.000000000"
        },
        "plotPoints": [
          {
            "x": "-2",
            "y": "11.111111111111111",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.9333333333333333",
            "y": "11.314049586776861",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.8666666666666667",
            "y": "11.528393726338562",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.8",
            "y": "11.755102040816327",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.7333333333333334",
            "y": "11.995240928019035",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.6666666666666667",
            "y": "12.25",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.6000000000000001",
            "y": "12.520710059171595",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.5333333333333332",
            "y": "12.808864265927976",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.4666666666666668",
            "y": "13.116143170197223",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.3999999999999999",
            "y": "13.444444444444446",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.3333333333333335",
            "y": "13.795918367346941",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.2666666666666666",
            "y": "14.173010380622836",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.2",
            "y": "14.578512396694215",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.1333333333333333",
            "y": "15.015624999999996",
            "series": "Finite null statistic"
          },
          {
            "x": "-1.0666666666666667",
            "y": "15.488033298647242",
            "series": "Finite null statistic"
          },
          {
            "x": "-1",
            "y": "16",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.93333333333333335",
            "y": "16.556480380499409",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.8666666666666667",
            "y": "17.163265306122447",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.80000000000000004",
            "y": "17.827160493827158",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.73333333333333339",
            "y": "18.556213017751478",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.66666666666666674",
            "y": "19.359999999999999",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.60000000000000009",
            "y": "20.249999999999996",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.53333333333333344",
            "y": "21.240075614366727",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.46666666666666656",
            "y": "22.347107438016536",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.39999999999999991",
            "y": "23.591836734693878",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.33333333333333326",
            "y": "24.999999999999996",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.26666666666666661",
            "y": "26.603878116343491",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.19999999999999996",
            "y": "28.44444444444445",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.1333333333333333",
            "y": "30.574394463667822",
            "series": "Finite null statistic"
          },
          {
            "x": "-0.066666666666666652",
            "y": "33.0625",
            "series": "Finite null statistic"
          },
          {
            "x": "0",
            "y": "36",
            "series": "Finite null statistic"
          },
          {
            "x": "0.066666666666666874",
            "y": "39.510204081632665",
            "series": "Finite null statistic"
          },
          {
            "x": "0.1333333333333333",
            "y": "43.763313609467453",
            "series": "Finite null statistic"
          },
          {
            "x": "0.20000000000000018",
            "y": "49.000000000000021",
            "series": "Finite null statistic"
          },
          {
            "x": "0.26666666666666661",
            "y": "55.570247933884282",
            "series": "Finite null statistic"
          },
          {
            "x": "0.33333333333333348",
            "y": "64.000000000000028",
            "series": "Finite null statistic"
          },
          {
            "x": "0.39999999999999991",
            "y": "75.1111111111111",
            "series": "Finite null statistic"
          },
          {
            "x": "0.46666666666666679",
            "y": "90.250000000000043",
            "series": "Finite null statistic"
          },
          {
            "x": "0.53333333333333321",
            "y": "111.75510204081628",
            "series": "Finite null statistic"
          },
          {
            "x": "0.60000000000000009",
            "y": "144.00000000000006",
            "series": "Finite null statistic"
          },
          {
            "x": "0.66666666666666652",
            "y": "195.99999999999986",
            "series": "Finite null statistic"
          },
          {
            "x": "0.73333333333333339",
            "y": "288.99999999999989",
            "series": "Finite null statistic"
          },
          {
            "x": "0.79999999999999982",
            "y": "483.99999999999966",
            "series": "Finite null statistic"
          },
          {
            "x": "0.8666666666666667",
            "y": "1023.9999999999998",
            "series": "Finite null statistic"
          },
          {
            "x": "0.93333333333333313",
            "y": "3843.9999999999759",
            "series": "Finite null statistic"
          },
          {
            "x": "1",
            "y": "",
            "series": "Finite null statistic"
          },
          {
            "x": "1.0666666666666669",
            "y": "3363.9999999999773",
            "series": "Finite null statistic"
          },
          {
            "x": "1.1333333333333333",
            "y": "784.00000000000477",
            "series": "Finite null statistic"
          },
          {
            "x": "1.2000000000000002",
            "y": "323.99999999999966",
            "series": "Finite null statistic"
          },
          {
            "x": "1.2666666666666666",
            "y": "168.99999999999997",
            "series": "Finite null statistic"
          },
          {
            "x": "1.3333333333333335",
            "y": "99.999999999999943",
            "series": "Finite null statistic"
          },
          {
            "x": "1.3999999999999999",
            "y": "64.000000000000043",
            "series": "Finite null statistic"
          },
          {
            "x": "1.4666666666666668",
            "y": "43.183673469387692",
            "series": "Finite null statistic"
          },
          {
            "x": "1.5333333333333332",
            "y": "30.25",
            "series": "Finite null statistic"
          },
          {
            "x": "1.6000000000000001",
            "y": "21.777777777777757",
            "series": "Finite null statistic"
          },
          {
            "x": "1.6666666666666665",
            "y": "16.000000000000011",
            "series": "Finite null statistic"
          },
          {
            "x": "1.7333333333333334",
            "y": "11.933884297520658",
            "series": "Finite null statistic"
          },
          {
            "x": "1.7999999999999998",
            "y": "9.0000000000000071",
            "series": "Finite null statistic"
          },
          {
            "x": "1.8666666666666667",
            "y": "6.8402366863905302",
            "series": "Finite null statistic"
          },
          {
            "x": "1.9333333333333331",
            "y": "5.2244897959183731",
            "series": "Finite null statistic"
          },
          {
            "x": "2",
            "y": "4",
            "series": "Finite null statistic"
          },
          {
            "x": "2.0666666666666664",
            "y": "3.0625000000000031",
            "series": "Finite null statistic"
          },
          {
            "x": "2.1333333333333337",
            "y": "2.3391003460207571",
            "series": "Finite null statistic"
          },
          {
            "x": "2.2000000000000002",
            "y": "1.7777777777777763",
            "series": "Finite null statistic"
          },
          {
            "x": "2.2666666666666666",
            "y": "1.3407202216066489",
            "series": "Finite null statistic"
          },
          {
            "x": "2.333333333333333",
            "y": "1.0000000000000016",
            "series": "Finite null statistic"
          },
          {
            "x": "2.4000000000000004",
            "y": "0.73469387755101923",
            "series": "Finite null statistic"
          },
          {
            "x": "2.4666666666666668",
            "y": "0.52892561983471043",
            "series": "Finite null statistic"
          },
          {
            "x": "2.5333333333333332",
            "y": "0.37051039697542554",
            "series": "Finite null statistic"
          },
          {
            "x": "2.5999999999999996",
            "y": "0.25000000000000056",
            "series": "Finite null statistic"
          },
          {
            "x": "2.666666666666667",
            "y": "0.15999999999999967",
            "series": "Finite null statistic"
          },
          {
            "x": "2.7333333333333334",
            "y": "0.094674556213017722",
            "series": "Finite null statistic"
          },
          {
            "x": "2.7999999999999998",
            "y": "0.04938271604938281",
            "series": "Finite null statistic"
          },
          {
            "x": "2.8666666666666663",
            "y": "0.020408163265306263",
            "series": "Finite null statistic"
          },
          {
            "x": "2.9333333333333336",
            "y": "0.0047562425683709518",
            "series": "Finite null statistic"
          },
          {
            "x": "3",
            "y": "0",
            "series": "Finite null statistic"
          },
          {
            "x": "3.0666666666666664",
            "y": "0.0041623309053069428",
            "series": "Finite null statistic"
          },
          {
            "x": "3.1333333333333337",
            "y": "0.015625000000000094",
            "series": "Finite null statistic"
          },
          {
            "x": "3.2000000000000002",
            "y": "0.033057851239669471",
            "series": "Finite null statistic"
          },
          {
            "x": "3.2666666666666666",
            "y": "0.055363321799307932",
            "series": "Finite null statistic"
          },
          {
            "x": "3.333333333333333",
            "y": "0.081632653061224372",
            "series": "Finite null statistic"
          },
          {
            "x": "3.4000000000000004",
            "y": "0.11111111111111127",
            "series": "Finite null statistic"
          },
          {
            "x": "3.4666666666666668",
            "y": "0.14317019722425131",
            "series": "Finite null statistic"
          },
          {
            "x": "3.5333333333333332",
            "y": "0.17728531855955673",
            "series": "Finite null statistic"
          },
          {
            "x": "3.5999999999999996",
            "y": "0.21301775147928975",
            "series": "Finite null statistic"
          },
          {
            "x": "3.666666666666667",
            "y": "0.25000000000000017",
            "series": "Finite null statistic"
          },
          {
            "x": "3.7333333333333334",
            "y": "0.28792385484830463",
            "series": "Finite null statistic"
          },
          {
            "x": "3.7999999999999998",
            "y": "0.32653061224489782",
            "series": "Finite null statistic"
          },
          {
            "x": "3.8666666666666663",
            "y": "0.36560302866414257",
            "series": "Finite null statistic"
          },
          {
            "x": "3.9333333333333336",
            "y": "0.40495867768595051",
            "series": "Finite null statistic"
          },
          {
            "x": "4",
            "y": "0.44444444444444442",
            "series": "Finite null statistic"
          },
          {
            "x": "4.0666666666666664",
            "y": "0.48393194706994314",
            "series": "Finite null statistic"
          },
          {
            "x": "4.1333333333333337",
            "y": "0.52331371661385273",
            "series": "Finite null statistic"
          },
          {
            "x": "4.2000000000000002",
            "y": "0.56250000000000011",
            "series": "Finite null statistic"
          },
          {
            "x": "4.2666666666666666",
            "y": "0.60141607663473551",
            "series": "Finite null statistic"
          },
          {
            "x": "4.333333333333333",
            "y": "0.6399999999999999",
            "series": "Finite null statistic"
          },
          {
            "x": "4.4000000000000004",
            "y": "0.67820069204152278",
            "series": "Finite null statistic"
          },
          {
            "x": "4.4666666666666668",
            "y": "0.71597633136094696",
            "series": "Finite null statistic"
          },
          {
            "x": "4.5333333333333332",
            "y": "0.75329298682805279",
            "series": "Finite null statistic"
          },
          {
            "x": "4.5999999999999996",
            "y": "0.79012345679012319",
            "series": "Finite null statistic"
          },
          {
            "x": "4.666666666666667",
            "y": "0.82644628099173556",
            "series": "Finite null statistic"
          },
          {
            "x": "4.7333333333333334",
            "y": "0.8622448979591838",
            "series": "Finite null statistic"
          },
          {
            "x": "4.7999999999999998",
            "y": "0.8975069252077561",
            "series": "Finite null statistic"
          },
          {
            "x": "4.8666666666666663",
            "y": "0.93222354340071312",
            "series": "Finite null statistic"
          },
          {
            "x": "4.9333333333333336",
            "y": "0.96638896868715884",
            "series": "Finite null statistic"
          },
          {
            "x": "5",
            "y": "1",
            "series": "Finite null statistic"
          },
          {
            "x": "5.0666666666666664",
            "y": "1.0330556302069334",
            "series": "Finite null statistic"
          },
          {
            "x": "5.1333333333333337",
            "y": "1.0655567117585849",
            "series": "Finite null statistic"
          },
          {
            "x": "5.2000000000000002",
            "y": "1.0975056689342404",
            "series": "Finite null statistic"
          },
          {
            "x": "5.2666666666666666",
            "y": "1.12890625",
            "series": "Finite null statistic"
          },
          {
            "x": "5.333333333333333",
            "y": "1.1597633136094672",
            "series": "Finite null statistic"
          },
          {
            "x": "5.4000000000000004",
            "y": "1.1900826446280992",
            "series": "Finite null statistic"
          },
          {
            "x": "5.4666666666666668",
            "y": "1.2198707952773449",
            "series": "Finite null statistic"
          },
          {
            "x": "5.5333333333333332",
            "y": "1.2491349480968859",
            "series": "Finite null statistic"
          },
          {
            "x": "5.5999999999999996",
            "y": "1.2778827977315688",
            "series": "Finite null statistic"
          },
          {
            "x": "5.666666666666667",
            "y": "1.306122448979592",
            "series": "Finite null statistic"
          },
          {
            "x": "5.7333333333333334",
            "y": "1.3338623289029954",
            "series": "Finite null statistic"
          },
          {
            "x": "5.7999999999999998",
            "y": "1.3611111111111109",
            "series": "Finite null statistic"
          },
          {
            "x": "5.8666666666666663",
            "y": "1.387877650591105",
            "series": "Finite null statistic"
          },
          {
            "x": "5.9333333333333336",
            "y": "1.4141709276844414",
            "series": "Finite null statistic"
          },
          {
            "x": "6",
            "y": "1.4399999999999999",
            "series": "Finite null statistic"
          }
        ],
        "plotFile": "metr18-fixed-results/ar-zero-null-variance-r/plot.svg",
        "plotSHA256": "ed95f5386c5fc93bfb6e71a59022e12f05bcfc5cf33546f77f1fca9449d7386d",
        "files": [
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-r/full-result.Rtext",
            "sha256": "1a2598e6264142d712a90793e7f36a58d520ea6450cd408be24c79e69311d7c7"
          },
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-r/plot-points.csv",
            "sha256": "a8787ba73e61a10082747991fa178c11cd484d06e7c80e07368102a9f7a47fae"
          },
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-r/plot.svg",
            "sha256": "ed95f5386c5fc93bfb6e71a59022e12f05bcfc5cf33546f77f1fca9449d7386d"
          },
          {
            "file": "metr18-fixed-results/ar-zero-null-variance-r/summary.csv",
            "sha256": "36d185d0aa79931ad3eb4ece492e74f6612d1d90d8d30a0df478ac3cc2147d2d"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    }
  },
  "fieller": {
    "python": {
      "bounded-interval": {
        "api": "fieller",
        "variant": "bounded-interval",
        "language": "python",
        "codeFile": "metr18-code/fieller-bounded-interval.py",
        "codeSHA256": "9373b4fbe1231f04acf61fac8892be89ff8dcb1d015fc71cf6b55a6a57b2939f",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '0', 'pi': '2', 'covariance': [['1', '0'], ['0', '1']], 'criticalValue': '2'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '0', 'pi': '2', 'covariance': [['1', '0'], ['0', '1']], 'criticalValue': '2'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "0",
          "pi": "2",
          "covariance": [
            [
              "1",
              "0"
            ],
            [
              "0",
              "1"
            ]
          ],
          "criticalValue": "2"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=2.000000000, B=0.000000000, C=-2.000000000, discriminant=16.000000000, setType=bounded-interval, criticalValue=2.000000000\r\n",
        "stderr": "",
        "summary": {
          "A": "2.000000000",
          "B": "0.000000000",
          "C": "-2.000000000",
          "discriminant": "16.000000000",
          "setType": "bounded-interval",
          "criticalValue": "2.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "16",
            "series": "Exact quadratic"
          },
          {
            "x": "-59/20",
            "y": "3081/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/10",
            "y": "741/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-57/20",
            "y": "2849/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-14/5",
            "y": "342/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/4",
            "y": "105/8",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/10",
            "y": "629/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-53/20",
            "y": "2409/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/5",
            "y": "288/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-51/20",
            "y": "2201/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/2",
            "y": "21/2",
            "series": "Exact quadratic"
          },
          {
            "x": "-49/20",
            "y": "2001/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-12/5",
            "y": "238/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-47/20",
            "y": "1809/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/10",
            "y": "429/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/4",
            "y": "65/8",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/5",
            "y": "192/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-43/20",
            "y": "1449/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/10",
            "y": "341/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-41/20",
            "y": "1281/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-2",
            "y": "6",
            "series": "Exact quadratic"
          },
          {
            "x": "-39/20",
            "y": "1121/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/10",
            "y": "261/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-37/20",
            "y": "969/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/5",
            "y": "112/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/4",
            "y": "33/8",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/10",
            "y": "189/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-33/20",
            "y": "689/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-8/5",
            "y": "78/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-31/20",
            "y": "561/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/2",
            "y": "5/2",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/20",
            "y": "441/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/5",
            "y": "48/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/20",
            "y": "329/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/10",
            "y": "69/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/4",
            "y": "9/8",
            "series": "Exact quadratic"
          },
          {
            "x": "-6/5",
            "y": "22/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/20",
            "y": "129/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/10",
            "y": "21/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/20",
            "y": "41/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-1",
            "y": "0",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/20",
            "y": "-39/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/10",
            "y": "-19/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/20",
            "y": "-111/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-4/5",
            "y": "-18/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/4",
            "y": "-7/8",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/10",
            "y": "-51/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/20",
            "y": "-231/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/5",
            "y": "-32/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/20",
            "y": "-279/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/2",
            "y": "-3/2",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/20",
            "y": "-319/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-2/5",
            "y": "-42/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/20",
            "y": "-351/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/10",
            "y": "-91/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/4",
            "y": "-15/8",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/5",
            "y": "-48/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/20",
            "y": "-391/200",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/10",
            "y": "-99/50",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/20",
            "y": "-399/200",
            "series": "Exact quadratic"
          },
          {
            "x": "0",
            "y": "-2",
            "series": "Exact quadratic"
          },
          {
            "x": "1/20",
            "y": "-399/200",
            "series": "Exact quadratic"
          },
          {
            "x": "1/10",
            "y": "-99/50",
            "series": "Exact quadratic"
          },
          {
            "x": "3/20",
            "y": "-391/200",
            "series": "Exact quadratic"
          },
          {
            "x": "1/5",
            "y": "-48/25",
            "series": "Exact quadratic"
          },
          {
            "x": "1/4",
            "y": "-15/8",
            "series": "Exact quadratic"
          },
          {
            "x": "3/10",
            "y": "-91/50",
            "series": "Exact quadratic"
          },
          {
            "x": "7/20",
            "y": "-351/200",
            "series": "Exact quadratic"
          },
          {
            "x": "2/5",
            "y": "-42/25",
            "series": "Exact quadratic"
          },
          {
            "x": "9/20",
            "y": "-319/200",
            "series": "Exact quadratic"
          },
          {
            "x": "1/2",
            "y": "-3/2",
            "series": "Exact quadratic"
          },
          {
            "x": "11/20",
            "y": "-279/200",
            "series": "Exact quadratic"
          },
          {
            "x": "3/5",
            "y": "-32/25",
            "series": "Exact quadratic"
          },
          {
            "x": "13/20",
            "y": "-231/200",
            "series": "Exact quadratic"
          },
          {
            "x": "7/10",
            "y": "-51/50",
            "series": "Exact quadratic"
          },
          {
            "x": "3/4",
            "y": "-7/8",
            "series": "Exact quadratic"
          },
          {
            "x": "4/5",
            "y": "-18/25",
            "series": "Exact quadratic"
          },
          {
            "x": "17/20",
            "y": "-111/200",
            "series": "Exact quadratic"
          },
          {
            "x": "9/10",
            "y": "-19/50",
            "series": "Exact quadratic"
          },
          {
            "x": "19/20",
            "y": "-39/200",
            "series": "Exact quadratic"
          },
          {
            "x": "1",
            "y": "0",
            "series": "Exact quadratic"
          },
          {
            "x": "21/20",
            "y": "41/200",
            "series": "Exact quadratic"
          },
          {
            "x": "11/10",
            "y": "21/50",
            "series": "Exact quadratic"
          },
          {
            "x": "23/20",
            "y": "129/200",
            "series": "Exact quadratic"
          },
          {
            "x": "6/5",
            "y": "22/25",
            "series": "Exact quadratic"
          },
          {
            "x": "5/4",
            "y": "9/8",
            "series": "Exact quadratic"
          },
          {
            "x": "13/10",
            "y": "69/50",
            "series": "Exact quadratic"
          },
          {
            "x": "27/20",
            "y": "329/200",
            "series": "Exact quadratic"
          },
          {
            "x": "7/5",
            "y": "48/25",
            "series": "Exact quadratic"
          },
          {
            "x": "29/20",
            "y": "441/200",
            "series": "Exact quadratic"
          },
          {
            "x": "3/2",
            "y": "5/2",
            "series": "Exact quadratic"
          },
          {
            "x": "31/20",
            "y": "561/200",
            "series": "Exact quadratic"
          },
          {
            "x": "8/5",
            "y": "78/25",
            "series": "Exact quadratic"
          },
          {
            "x": "33/20",
            "y": "689/200",
            "series": "Exact quadratic"
          },
          {
            "x": "17/10",
            "y": "189/50",
            "series": "Exact quadratic"
          },
          {
            "x": "7/4",
            "y": "33/8",
            "series": "Exact quadratic"
          },
          {
            "x": "9/5",
            "y": "112/25",
            "series": "Exact quadratic"
          },
          {
            "x": "37/20",
            "y": "969/200",
            "series": "Exact quadratic"
          },
          {
            "x": "19/10",
            "y": "261/50",
            "series": "Exact quadratic"
          },
          {
            "x": "39/20",
            "y": "1121/200",
            "series": "Exact quadratic"
          },
          {
            "x": "2",
            "y": "6",
            "series": "Exact quadratic"
          },
          {
            "x": "41/20",
            "y": "1281/200",
            "series": "Exact quadratic"
          },
          {
            "x": "21/10",
            "y": "341/50",
            "series": "Exact quadratic"
          },
          {
            "x": "43/20",
            "y": "1449/200",
            "series": "Exact quadratic"
          },
          {
            "x": "11/5",
            "y": "192/25",
            "series": "Exact quadratic"
          },
          {
            "x": "9/4",
            "y": "65/8",
            "series": "Exact quadratic"
          },
          {
            "x": "23/10",
            "y": "429/50",
            "series": "Exact quadratic"
          },
          {
            "x": "47/20",
            "y": "1809/200",
            "series": "Exact quadratic"
          },
          {
            "x": "12/5",
            "y": "238/25",
            "series": "Exact quadratic"
          },
          {
            "x": "49/20",
            "y": "2001/200",
            "series": "Exact quadratic"
          },
          {
            "x": "5/2",
            "y": "21/2",
            "series": "Exact quadratic"
          },
          {
            "x": "51/20",
            "y": "2201/200",
            "series": "Exact quadratic"
          },
          {
            "x": "13/5",
            "y": "288/25",
            "series": "Exact quadratic"
          },
          {
            "x": "53/20",
            "y": "2409/200",
            "series": "Exact quadratic"
          },
          {
            "x": "27/10",
            "y": "629/50",
            "series": "Exact quadratic"
          },
          {
            "x": "11/4",
            "y": "105/8",
            "series": "Exact quadratic"
          },
          {
            "x": "14/5",
            "y": "342/25",
            "series": "Exact quadratic"
          },
          {
            "x": "57/20",
            "y": "2849/200",
            "series": "Exact quadratic"
          },
          {
            "x": "29/10",
            "y": "741/50",
            "series": "Exact quadratic"
          },
          {
            "x": "59/20",
            "y": "3081/200",
            "series": "Exact quadratic"
          },
          {
            "x": "3",
            "y": "16",
            "series": "Exact quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-bounded-interval-python/plot.svg",
        "plotSHA256": "d04aceb3f653ae081a0d2a5f186e7096a892309b87867b5fea637231f516da57",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-python/full.json",
            "sha256": "b9f1b250df1badf3d4cad8257013a9b13e222e54af0ada3ae0c6e49cc51be817"
          },
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-python/plot-points.csv",
            "sha256": "cfcf0b0d4de1a0a2a99ec3bb51cef3f25d728d729636bccb7b0fae3e58126688"
          },
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-python/plot.svg",
            "sha256": "d04aceb3f653ae081a0d2a5f186e7096a892309b87867b5fea637231f516da57"
          },
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-python/summary.csv",
            "sha256": "1a10f2eb0d7deca38081ef2c2476f72e8550281bfd66366c0052fa2d2cdb7138"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "two-unbounded-rays": {
        "api": "fieller",
        "variant": "two-unbounded-rays",
        "language": "python",
        "codeFile": "metr18-code/fieller-two-unbounded-rays.py",
        "codeSHA256": "4088f84e4af26ae99e341a8a2cb6edb268c5d063ce62c9a08f76bc0ef74e254c",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '3', 'pi': '0', 'covariance': [['1', '0'], ['0', '1']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '3', 'pi': '0', 'covariance': [['1', '0'], ['0', '1']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "3",
          "pi": "0",
          "covariance": [
            [
              "1",
              "0"
            ],
            [
              "0",
              "1"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=-4.000000000, B=0.000000000, C=5.000000000, discriminant=80.000000000, setType=two-rays, criticalValue=4.000000000\r\n",
        "stderr": "",
        "summary": {
          "A": "-4.000000000",
          "B": "0.000000000",
          "C": "5.000000000",
          "discriminant": "80.000000000",
          "setType": "two-rays",
          "criticalValue": "4.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "-31",
            "series": "Exact quadratic"
          },
          {
            "x": "-59/20",
            "y": "-2981/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/10",
            "y": "-716/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-57/20",
            "y": "-2749/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-14/5",
            "y": "-659/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/4",
            "y": "-101/4",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/10",
            "y": "-604/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-53/20",
            "y": "-2309/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/5",
            "y": "-551/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-51/20",
            "y": "-2101/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/2",
            "y": "-20",
            "series": "Exact quadratic"
          },
          {
            "x": "-49/20",
            "y": "-1901/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-12/5",
            "y": "-451/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-47/20",
            "y": "-1709/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/10",
            "y": "-404/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/4",
            "y": "-61/4",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/5",
            "y": "-359/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-43/20",
            "y": "-1349/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/10",
            "y": "-316/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-41/20",
            "y": "-1181/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-2",
            "y": "-11",
            "series": "Exact quadratic"
          },
          {
            "x": "-39/20",
            "y": "-1021/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/10",
            "y": "-236/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-37/20",
            "y": "-869/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/5",
            "y": "-199/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/4",
            "y": "-29/4",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/10",
            "y": "-164/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-33/20",
            "y": "-589/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-8/5",
            "y": "-131/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-31/20",
            "y": "-461/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/2",
            "y": "-4",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/20",
            "y": "-341/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/5",
            "y": "-71/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/20",
            "y": "-229/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/10",
            "y": "-44/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/4",
            "y": "-5/4",
            "series": "Exact quadratic"
          },
          {
            "x": "-6/5",
            "y": "-19/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/20",
            "y": "-29/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/10",
            "y": "4/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/20",
            "y": "59/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/20",
            "y": "139/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/10",
            "y": "44/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/20",
            "y": "211/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-4/5",
            "y": "61/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/4",
            "y": "11/4",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/10",
            "y": "76/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/20",
            "y": "331/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/5",
            "y": "89/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/20",
            "y": "379/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/2",
            "y": "4",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/20",
            "y": "419/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-2/5",
            "y": "109/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/20",
            "y": "451/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/10",
            "y": "116/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/4",
            "y": "19/4",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/5",
            "y": "121/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/20",
            "y": "491/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/10",
            "y": "124/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/20",
            "y": "499/100",
            "series": "Exact quadratic"
          },
          {
            "x": "0",
            "y": "5",
            "series": "Exact quadratic"
          },
          {
            "x": "1/20",
            "y": "499/100",
            "series": "Exact quadratic"
          },
          {
            "x": "1/10",
            "y": "124/25",
            "series": "Exact quadratic"
          },
          {
            "x": "3/20",
            "y": "491/100",
            "series": "Exact quadratic"
          },
          {
            "x": "1/5",
            "y": "121/25",
            "series": "Exact quadratic"
          },
          {
            "x": "1/4",
            "y": "19/4",
            "series": "Exact quadratic"
          },
          {
            "x": "3/10",
            "y": "116/25",
            "series": "Exact quadratic"
          },
          {
            "x": "7/20",
            "y": "451/100",
            "series": "Exact quadratic"
          },
          {
            "x": "2/5",
            "y": "109/25",
            "series": "Exact quadratic"
          },
          {
            "x": "9/20",
            "y": "419/100",
            "series": "Exact quadratic"
          },
          {
            "x": "1/2",
            "y": "4",
            "series": "Exact quadratic"
          },
          {
            "x": "11/20",
            "y": "379/100",
            "series": "Exact quadratic"
          },
          {
            "x": "3/5",
            "y": "89/25",
            "series": "Exact quadratic"
          },
          {
            "x": "13/20",
            "y": "331/100",
            "series": "Exact quadratic"
          },
          {
            "x": "7/10",
            "y": "76/25",
            "series": "Exact quadratic"
          },
          {
            "x": "3/4",
            "y": "11/4",
            "series": "Exact quadratic"
          },
          {
            "x": "4/5",
            "y": "61/25",
            "series": "Exact quadratic"
          },
          {
            "x": "17/20",
            "y": "211/100",
            "series": "Exact quadratic"
          },
          {
            "x": "9/10",
            "y": "44/25",
            "series": "Exact quadratic"
          },
          {
            "x": "19/20",
            "y": "139/100",
            "series": "Exact quadratic"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Exact quadratic"
          },
          {
            "x": "21/20",
            "y": "59/100",
            "series": "Exact quadratic"
          },
          {
            "x": "11/10",
            "y": "4/25",
            "series": "Exact quadratic"
          },
          {
            "x": "23/20",
            "y": "-29/100",
            "series": "Exact quadratic"
          },
          {
            "x": "6/5",
            "y": "-19/25",
            "series": "Exact quadratic"
          },
          {
            "x": "5/4",
            "y": "-5/4",
            "series": "Exact quadratic"
          },
          {
            "x": "13/10",
            "y": "-44/25",
            "series": "Exact quadratic"
          },
          {
            "x": "27/20",
            "y": "-229/100",
            "series": "Exact quadratic"
          },
          {
            "x": "7/5",
            "y": "-71/25",
            "series": "Exact quadratic"
          },
          {
            "x": "29/20",
            "y": "-341/100",
            "series": "Exact quadratic"
          },
          {
            "x": "3/2",
            "y": "-4",
            "series": "Exact quadratic"
          },
          {
            "x": "31/20",
            "y": "-461/100",
            "series": "Exact quadratic"
          },
          {
            "x": "8/5",
            "y": "-131/25",
            "series": "Exact quadratic"
          },
          {
            "x": "33/20",
            "y": "-589/100",
            "series": "Exact quadratic"
          },
          {
            "x": "17/10",
            "y": "-164/25",
            "series": "Exact quadratic"
          },
          {
            "x": "7/4",
            "y": "-29/4",
            "series": "Exact quadratic"
          },
          {
            "x": "9/5",
            "y": "-199/25",
            "series": "Exact quadratic"
          },
          {
            "x": "37/20",
            "y": "-869/100",
            "series": "Exact quadratic"
          },
          {
            "x": "19/10",
            "y": "-236/25",
            "series": "Exact quadratic"
          },
          {
            "x": "39/20",
            "y": "-1021/100",
            "series": "Exact quadratic"
          },
          {
            "x": "2",
            "y": "-11",
            "series": "Exact quadratic"
          },
          {
            "x": "41/20",
            "y": "-1181/100",
            "series": "Exact quadratic"
          },
          {
            "x": "21/10",
            "y": "-316/25",
            "series": "Exact quadratic"
          },
          {
            "x": "43/20",
            "y": "-1349/100",
            "series": "Exact quadratic"
          },
          {
            "x": "11/5",
            "y": "-359/25",
            "series": "Exact quadratic"
          },
          {
            "x": "9/4",
            "y": "-61/4",
            "series": "Exact quadratic"
          },
          {
            "x": "23/10",
            "y": "-404/25",
            "series": "Exact quadratic"
          },
          {
            "x": "47/20",
            "y": "-1709/100",
            "series": "Exact quadratic"
          },
          {
            "x": "12/5",
            "y": "-451/25",
            "series": "Exact quadratic"
          },
          {
            "x": "49/20",
            "y": "-1901/100",
            "series": "Exact quadratic"
          },
          {
            "x": "5/2",
            "y": "-20",
            "series": "Exact quadratic"
          },
          {
            "x": "51/20",
            "y": "-2101/100",
            "series": "Exact quadratic"
          },
          {
            "x": "13/5",
            "y": "-551/25",
            "series": "Exact quadratic"
          },
          {
            "x": "53/20",
            "y": "-2309/100",
            "series": "Exact quadratic"
          },
          {
            "x": "27/10",
            "y": "-604/25",
            "series": "Exact quadratic"
          },
          {
            "x": "11/4",
            "y": "-101/4",
            "series": "Exact quadratic"
          },
          {
            "x": "14/5",
            "y": "-659/25",
            "series": "Exact quadratic"
          },
          {
            "x": "57/20",
            "y": "-2749/100",
            "series": "Exact quadratic"
          },
          {
            "x": "29/10",
            "y": "-716/25",
            "series": "Exact quadratic"
          },
          {
            "x": "59/20",
            "y": "-2981/100",
            "series": "Exact quadratic"
          },
          {
            "x": "3",
            "y": "-31",
            "series": "Exact quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-two-unbounded-rays-python/plot.svg",
        "plotSHA256": "b0878534440bbf57c643b5f831742e48af066d6c71cf01c701fde241fb0fd1df",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-python/full.json",
            "sha256": "2e82f368e6315cb7516c8cc4b018da232fd131e24e600e04c4f9698bfd476f9e"
          },
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-python/plot-points.csv",
            "sha256": "077477df49f2464c743518c03c437d59d5fb1446a4c560ca555330978a681525"
          },
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-python/plot.svg",
            "sha256": "b0878534440bbf57c643b5f831742e48af066d6c71cf01c701fde241fb0fd1df"
          },
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-python/summary.csv",
            "sha256": "52d8f1fd0040d6b2a3f34a71bdf9bc1164ef954883ab3e34918f5bc278046f9b"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "whole-real-line": {
        "api": "fieller",
        "variant": "whole-real-line",
        "language": "python",
        "codeFile": "metr18-code/fieller-whole-real-line.py",
        "codeSHA256": "0abb1a6cafd56abb11a12942666bdc8d71045dd38e0d6859ca43f89ca02e9589",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '1/5', 'pi': '1/10', 'covariance': [['1/25', '1/100'], ['1/100', '9/100']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '1/5', 'pi': '1/10', 'covariance': [['1/25', '1/100'], ['1/100', '9/100']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "1/5",
          "pi": "1/10",
          "covariance": [
            [
              "1/25",
              "1/100"
            ],
            [
              "1/100",
              "9/100"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=-0.350000000, B=0.040000000, C=-0.120000000, discriminant=-0.166400000, setType=all-real, criticalValue=4.000000000\r\n",
        "stderr": "",
        "summary": {
          "A": "-0.350000000",
          "B": "0.040000000",
          "C": "-0.120000000",
          "discriminant": "-0.166400000",
          "setType": "all-real",
          "criticalValue": "4.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "-339/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-59/20",
            "y": "-26271/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/10",
            "y": "-6359/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-57/20",
            "y": "-4923/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-14/5",
            "y": "-372/125",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/4",
            "y": "-4603/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/10",
            "y": "-5559/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-53/20",
            "y": "-21471/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/5",
            "y": "-259/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-51/20",
            "y": "-19983/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/2",
            "y": "-963/400",
            "series": "Exact quadratic"
          },
          {
            "x": "-49/20",
            "y": "-18551/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-12/5",
            "y": "-279/125",
            "series": "Exact quadratic"
          },
          {
            "x": "-47/20",
            "y": "-687/320",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/10",
            "y": "-4127/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/4",
            "y": "-3171/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/5",
            "y": "-951/500",
            "series": "Exact quadratic"
          },
          {
            "x": "-43/20",
            "y": "-14591/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/10",
            "y": "-699/400",
            "series": "Exact quadratic"
          },
          {
            "x": "-41/20",
            "y": "-13383/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-2",
            "y": "-8/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-39/20",
            "y": "-12231/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/10",
            "y": "-2919/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-37/20",
            "y": "-2227/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/5",
            "y": "-663/500",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/4",
            "y": "-2019/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/10",
            "y": "-2399/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-33/20",
            "y": "-9111/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-8/5",
            "y": "-27/25",
            "series": "Exact quadratic"
          },
          {
            "x": "-31/20",
            "y": "-8183/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/2",
            "y": "-387/400",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/20",
            "y": "-7311/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/5",
            "y": "-431/500",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/20",
            "y": "-1299/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/10",
            "y": "-1527/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/4",
            "y": "-1147/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-6/5",
            "y": "-84/125",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/20",
            "y": "-5031/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/10",
            "y": "-47/80",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/20",
            "y": "-4383/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-1",
            "y": "-51/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/20",
            "y": "-3791/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/10",
            "y": "-879/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/20",
            "y": "-651/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-4/5",
            "y": "-47/125",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/4",
            "y": "-111/320",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/10",
            "y": "-639/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/20",
            "y": "-2351/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/5",
            "y": "-27/100",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/20",
            "y": "-1983/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/2",
            "y": "-91/400",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/20",
            "y": "-1671/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-2/5",
            "y": "-24/125",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/20",
            "y": "-283/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/10",
            "y": "-327/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/4",
            "y": "-243/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/5",
            "y": "-71/500",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/20",
            "y": "-1071/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/10",
            "y": "-51/400",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/20",
            "y": "-983/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "0",
            "y": "-3/25",
            "series": "Exact quadratic"
          },
          {
            "x": "1/20",
            "y": "-951/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "1/10",
            "y": "-239/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "3/20",
            "y": "-39/320",
            "series": "Exact quadratic"
          },
          {
            "x": "1/5",
            "y": "-63/500",
            "series": "Exact quadratic"
          },
          {
            "x": "1/4",
            "y": "-211/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "3/10",
            "y": "-279/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "7/20",
            "y": "-1191/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "2/5",
            "y": "-4/25",
            "series": "Exact quadratic"
          },
          {
            "x": "9/20",
            "y": "-1383/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "1/2",
            "y": "-3/16",
            "series": "Exact quadratic"
          },
          {
            "x": "11/20",
            "y": "-1631/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "3/5",
            "y": "-111/500",
            "series": "Exact quadratic"
          },
          {
            "x": "13/20",
            "y": "-387/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "7/10",
            "y": "-527/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "3/4",
            "y": "-459/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "4/5",
            "y": "-39/125",
            "series": "Exact quadratic"
          },
          {
            "x": "17/20",
            "y": "-2711/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "9/10",
            "y": "-147/400",
            "series": "Exact quadratic"
          },
          {
            "x": "19/20",
            "y": "-3183/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "1",
            "y": "-43/100",
            "series": "Exact quadratic"
          },
          {
            "x": "21/20",
            "y": "-3711/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "11/10",
            "y": "-999/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "23/20",
            "y": "-859/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "6/5",
            "y": "-72/125",
            "series": "Exact quadratic"
          },
          {
            "x": "5/4",
            "y": "-987/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "13/10",
            "y": "-1319/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "27/20",
            "y": "-5631/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "7/5",
            "y": "-3/4",
            "series": "Exact quadratic"
          },
          {
            "x": "29/20",
            "y": "-6383/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "3/2",
            "y": "-339/400",
            "series": "Exact quadratic"
          },
          {
            "x": "31/20",
            "y": "-7191/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "8/5",
            "y": "-119/125",
            "series": "Exact quadratic"
          },
          {
            "x": "33/20",
            "y": "-1611/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "17/10",
            "y": "-2127/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "7/4",
            "y": "-359/320",
            "series": "Exact quadratic"
          },
          {
            "x": "9/5",
            "y": "-591/500",
            "series": "Exact quadratic"
          },
          {
            "x": "37/20",
            "y": "-9951/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "19/10",
            "y": "-523/400",
            "series": "Exact quadratic"
          },
          {
            "x": "39/20",
            "y": "-10983/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "2",
            "y": "-36/25",
            "series": "Exact quadratic"
          },
          {
            "x": "41/20",
            "y": "-12071/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "21/10",
            "y": "-3159/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "43/20",
            "y": "-2643/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "11/5",
            "y": "-863/500",
            "series": "Exact quadratic"
          },
          {
            "x": "9/4",
            "y": "-2883/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "23/10",
            "y": "-3759/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "47/20",
            "y": "-15671/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "12/5",
            "y": "-51/25",
            "series": "Exact quadratic"
          },
          {
            "x": "49/20",
            "y": "-16983/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "5/2",
            "y": "-883/400",
            "series": "Exact quadratic"
          },
          {
            "x": "51/20",
            "y": "-18351/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "13/5",
            "y": "-1191/500",
            "series": "Exact quadratic"
          },
          {
            "x": "53/20",
            "y": "-791/320",
            "series": "Exact quadratic"
          },
          {
            "x": "27/10",
            "y": "-5127/2000",
            "series": "Exact quadratic"
          },
          {
            "x": "11/4",
            "y": "-4251/1600",
            "series": "Exact quadratic"
          },
          {
            "x": "14/5",
            "y": "-344/125",
            "series": "Exact quadratic"
          },
          {
            "x": "57/20",
            "y": "-22791/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "29/10",
            "y": "-1179/400",
            "series": "Exact quadratic"
          },
          {
            "x": "59/20",
            "y": "-24383/8000",
            "series": "Exact quadratic"
          },
          {
            "x": "3",
            "y": "-63/20",
            "series": "Exact quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-whole-real-line-python/plot.svg",
        "plotSHA256": "fe94b0b1cc6c87c775b3d1975b14f25bbbd57591ba7e364403702e778b188cdb",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-python/full.json",
            "sha256": "bb37811fd876795cc028e509a23e33af183a6718cc0b6972454d88c8932b9f8a"
          },
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-python/plot-points.csv",
            "sha256": "0893fcfe5f5fc07f5a508a0fbd66f0ed18b4de72a90b3bc9ab5818d39959b6ca"
          },
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-python/plot.svg",
            "sha256": "fe94b0b1cc6c87c775b3d1975b14f25bbbd57591ba7e364403702e778b188cdb"
          },
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-python/summary.csv",
            "sha256": "42be8a2225da4ea03603152d9682e3085d45e1b72dbb48053200e395429e0313"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "linear-half-line": {
        "api": "fieller",
        "variant": "linear-half-line",
        "language": "python",
        "codeFile": "metr18-code/fieller-linear-half-line.py",
        "codeSHA256": "4e7ee3d63f122dd994e61481b621e41e96daca7ed3848c72a6052d62224e7977",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '1', 'pi': '2', 'covariance': [['1', '0'], ['0', '1']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '1', 'pi': '2', 'covariance': [['1', '0'], ['0', '1']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "1",
          "pi": "2",
          "covariance": [
            [
              "1",
              "0"
            ],
            [
              "0",
              "1"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=0.000000000, B=-4.000000000, C=-3.000000000, discriminant=16.000000000, setType=right-half-line, criticalValue=4.000000000\r\n",
        "stderr": "",
        "summary": {
          "A": "0.000000000",
          "B": "-4.000000000",
          "C": "-3.000000000",
          "discriminant": "16.000000000",
          "setType": "right-half-line",
          "criticalValue": "4.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "9",
            "series": "Exact quadratic"
          },
          {
            "x": "-59/20",
            "y": "44/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/10",
            "y": "43/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-57/20",
            "y": "42/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-14/5",
            "y": "41/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/4",
            "y": "8",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/10",
            "y": "39/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-53/20",
            "y": "38/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/5",
            "y": "37/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-51/20",
            "y": "36/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/2",
            "y": "7",
            "series": "Exact quadratic"
          },
          {
            "x": "-49/20",
            "y": "34/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-12/5",
            "y": "33/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-47/20",
            "y": "32/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/10",
            "y": "31/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/4",
            "y": "6",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/5",
            "y": "29/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-43/20",
            "y": "28/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/10",
            "y": "27/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-41/20",
            "y": "26/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-2",
            "y": "5",
            "series": "Exact quadratic"
          },
          {
            "x": "-39/20",
            "y": "24/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/10",
            "y": "23/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-37/20",
            "y": "22/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/5",
            "y": "21/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/4",
            "y": "4",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/10",
            "y": "19/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-33/20",
            "y": "18/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-8/5",
            "y": "17/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-31/20",
            "y": "16/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/2",
            "y": "3",
            "series": "Exact quadratic"
          },
          {
            "x": "-29/20",
            "y": "14/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/5",
            "y": "13/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-27/20",
            "y": "12/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/10",
            "y": "11/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-5/4",
            "y": "2",
            "series": "Exact quadratic"
          },
          {
            "x": "-6/5",
            "y": "9/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-23/20",
            "y": "8/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/10",
            "y": "7/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-21/20",
            "y": "6/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Exact quadratic"
          },
          {
            "x": "-19/20",
            "y": "4/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/10",
            "y": "3/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-17/20",
            "y": "2/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-4/5",
            "y": "1/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/4",
            "y": "0",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/10",
            "y": "-1/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-13/20",
            "y": "-2/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/5",
            "y": "-3/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-11/20",
            "y": "-4/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/2",
            "y": "-1",
            "series": "Exact quadratic"
          },
          {
            "x": "-9/20",
            "y": "-6/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-2/5",
            "y": "-7/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-7/20",
            "y": "-8/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/10",
            "y": "-9/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/4",
            "y": "-2",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/5",
            "y": "-11/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-3/20",
            "y": "-12/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/10",
            "y": "-13/5",
            "series": "Exact quadratic"
          },
          {
            "x": "-1/20",
            "y": "-14/5",
            "series": "Exact quadratic"
          },
          {
            "x": "0",
            "y": "-3",
            "series": "Exact quadratic"
          },
          {
            "x": "1/20",
            "y": "-16/5",
            "series": "Exact quadratic"
          },
          {
            "x": "1/10",
            "y": "-17/5",
            "series": "Exact quadratic"
          },
          {
            "x": "3/20",
            "y": "-18/5",
            "series": "Exact quadratic"
          },
          {
            "x": "1/5",
            "y": "-19/5",
            "series": "Exact quadratic"
          },
          {
            "x": "1/4",
            "y": "-4",
            "series": "Exact quadratic"
          },
          {
            "x": "3/10",
            "y": "-21/5",
            "series": "Exact quadratic"
          },
          {
            "x": "7/20",
            "y": "-22/5",
            "series": "Exact quadratic"
          },
          {
            "x": "2/5",
            "y": "-23/5",
            "series": "Exact quadratic"
          },
          {
            "x": "9/20",
            "y": "-24/5",
            "series": "Exact quadratic"
          },
          {
            "x": "1/2",
            "y": "-5",
            "series": "Exact quadratic"
          },
          {
            "x": "11/20",
            "y": "-26/5",
            "series": "Exact quadratic"
          },
          {
            "x": "3/5",
            "y": "-27/5",
            "series": "Exact quadratic"
          },
          {
            "x": "13/20",
            "y": "-28/5",
            "series": "Exact quadratic"
          },
          {
            "x": "7/10",
            "y": "-29/5",
            "series": "Exact quadratic"
          },
          {
            "x": "3/4",
            "y": "-6",
            "series": "Exact quadratic"
          },
          {
            "x": "4/5",
            "y": "-31/5",
            "series": "Exact quadratic"
          },
          {
            "x": "17/20",
            "y": "-32/5",
            "series": "Exact quadratic"
          },
          {
            "x": "9/10",
            "y": "-33/5",
            "series": "Exact quadratic"
          },
          {
            "x": "19/20",
            "y": "-34/5",
            "series": "Exact quadratic"
          },
          {
            "x": "1",
            "y": "-7",
            "series": "Exact quadratic"
          },
          {
            "x": "21/20",
            "y": "-36/5",
            "series": "Exact quadratic"
          },
          {
            "x": "11/10",
            "y": "-37/5",
            "series": "Exact quadratic"
          },
          {
            "x": "23/20",
            "y": "-38/5",
            "series": "Exact quadratic"
          },
          {
            "x": "6/5",
            "y": "-39/5",
            "series": "Exact quadratic"
          },
          {
            "x": "5/4",
            "y": "-8",
            "series": "Exact quadratic"
          },
          {
            "x": "13/10",
            "y": "-41/5",
            "series": "Exact quadratic"
          },
          {
            "x": "27/20",
            "y": "-42/5",
            "series": "Exact quadratic"
          },
          {
            "x": "7/5",
            "y": "-43/5",
            "series": "Exact quadratic"
          },
          {
            "x": "29/20",
            "y": "-44/5",
            "series": "Exact quadratic"
          },
          {
            "x": "3/2",
            "y": "-9",
            "series": "Exact quadratic"
          },
          {
            "x": "31/20",
            "y": "-46/5",
            "series": "Exact quadratic"
          },
          {
            "x": "8/5",
            "y": "-47/5",
            "series": "Exact quadratic"
          },
          {
            "x": "33/20",
            "y": "-48/5",
            "series": "Exact quadratic"
          },
          {
            "x": "17/10",
            "y": "-49/5",
            "series": "Exact quadratic"
          },
          {
            "x": "7/4",
            "y": "-10",
            "series": "Exact quadratic"
          },
          {
            "x": "9/5",
            "y": "-51/5",
            "series": "Exact quadratic"
          },
          {
            "x": "37/20",
            "y": "-52/5",
            "series": "Exact quadratic"
          },
          {
            "x": "19/10",
            "y": "-53/5",
            "series": "Exact quadratic"
          },
          {
            "x": "39/20",
            "y": "-54/5",
            "series": "Exact quadratic"
          },
          {
            "x": "2",
            "y": "-11",
            "series": "Exact quadratic"
          },
          {
            "x": "41/20",
            "y": "-56/5",
            "series": "Exact quadratic"
          },
          {
            "x": "21/10",
            "y": "-57/5",
            "series": "Exact quadratic"
          },
          {
            "x": "43/20",
            "y": "-58/5",
            "series": "Exact quadratic"
          },
          {
            "x": "11/5",
            "y": "-59/5",
            "series": "Exact quadratic"
          },
          {
            "x": "9/4",
            "y": "-12",
            "series": "Exact quadratic"
          },
          {
            "x": "23/10",
            "y": "-61/5",
            "series": "Exact quadratic"
          },
          {
            "x": "47/20",
            "y": "-62/5",
            "series": "Exact quadratic"
          },
          {
            "x": "12/5",
            "y": "-63/5",
            "series": "Exact quadratic"
          },
          {
            "x": "49/20",
            "y": "-64/5",
            "series": "Exact quadratic"
          },
          {
            "x": "5/2",
            "y": "-13",
            "series": "Exact quadratic"
          },
          {
            "x": "51/20",
            "y": "-66/5",
            "series": "Exact quadratic"
          },
          {
            "x": "13/5",
            "y": "-67/5",
            "series": "Exact quadratic"
          },
          {
            "x": "53/20",
            "y": "-68/5",
            "series": "Exact quadratic"
          },
          {
            "x": "27/10",
            "y": "-69/5",
            "series": "Exact quadratic"
          },
          {
            "x": "11/4",
            "y": "-14",
            "series": "Exact quadratic"
          },
          {
            "x": "14/5",
            "y": "-71/5",
            "series": "Exact quadratic"
          },
          {
            "x": "57/20",
            "y": "-72/5",
            "series": "Exact quadratic"
          },
          {
            "x": "29/10",
            "y": "-73/5",
            "series": "Exact quadratic"
          },
          {
            "x": "59/20",
            "y": "-74/5",
            "series": "Exact quadratic"
          },
          {
            "x": "3",
            "y": "-15",
            "series": "Exact quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-linear-half-line-python/plot.svg",
        "plotSHA256": "83fde556b6c7b327f6ac7a2f17b470af03e85bd2920d58769d05f3a8186526d0",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-python/full.json",
            "sha256": "d0d1961a3782fbda0b721dd122455de9805a0c7d06b8da7fc69c57be4f2afd1a"
          },
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-python/plot-points.csv",
            "sha256": "464eeef2b74edb1c2231c5759c855cb0edb8b3fec20a325ae6efa86a6b5a2f21"
          },
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-python/plot.svg",
            "sha256": "83fde556b6c7b327f6ac7a2f17b470af03e85bd2920d58769d05f3a8186526d0"
          },
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-python/summary.csv",
            "sha256": "00f2e651e9ae78b29f934633f953b7625bdf0c013adaf24395be0222c7542c40"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "reject-singular-covariance": {
        "api": "fieller",
        "variant": "reject-singular-covariance",
        "language": "python",
        "codeFile": "metr18-code/fieller-reject-singular-covariance.py",
        "codeSHA256": "eb769db165877bd824b8320eccddc39ece884d13d8302dad0ccd127a1ff9fc70",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '1', 'pi': '1', 'covariance': [['1', '1'], ['1', '1']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='fieller'\nINPUT={'delta': '1', 'pi': '1', 'covariance': [['1', '1'], ['1', '1']], 'criticalValue': '4'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "delta": "1",
          "pi": "1",
          "covariance": [
            [
              "1",
              "1"
            ],
            [
              "1",
              "1"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 2,
        "expectedFailure": true,
        "stdout": "",
        "stderr": "Rejected fixed input: Fieller requires positive definite covariance\r\n",
        "summary": {},
        "plotPoints": [],
        "plotFile": null,
        "plotSHA256": null,
        "files": [],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    },
    "r": {
      "bounded-interval": {
        "api": "fieller",
        "variant": "bounded-interval",
        "language": "r",
        "codeFile": "metr18-code/fieller-bounded-interval.R",
        "codeSHA256": "2b87fc347e9881907501e40c206221407a6edaa6b48decff868775e505422537",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"0\",pi=\"2\",covariance=list(list(\"1\",\"0\"),list(\"0\",\"1\")),criticalValue=\"2\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"0\",pi=\"2\",covariance=list(list(\"1\",\"0\"),list(\"0\",\"1\")),criticalValue=\"2\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "0",
          "pi": "2",
          "covariance": [
            [
              "1",
              "0"
            ],
            [
              "0",
              "1"
            ]
          ],
          "criticalValue": "2"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=2.000000000, B=0.000000000, C=-2.000000000, discriminant=16.000000000, setType=bounded-interval, criticalValue=2.000000000 \r\n",
        "stderr": "",
        "summary": {
          "A": "2.000000000",
          "B": "0.000000000",
          "C": "-2.000000000",
          "discriminant": "16.000000000",
          "setType": "bounded-interval",
          "criticalValue": "2.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "16",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.9500000000000002",
            "y": "15.405000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8999999999999999",
            "y": "14.82",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8500000000000001",
            "y": "14.245000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7999999999999998",
            "y": "13.679999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.75",
            "y": "13.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7000000000000002",
            "y": "12.580000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6499999999999999",
            "y": "12.045",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6000000000000001",
            "y": "11.520000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5499999999999998",
            "y": "11.004999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5",
            "y": "10.5",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.4500000000000002",
            "y": "10.005000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3999999999999999",
            "y": "9.5199999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3500000000000001",
            "y": "9.0450000000000017",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2999999999999998",
            "y": "8.5799999999999983",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.25",
            "y": "8.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2000000000000002",
            "y": "7.6800000000000015",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1499999999999999",
            "y": "7.2449999999999992",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1000000000000001",
            "y": "6.8200000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.0499999999999998",
            "y": "6.4049999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2",
            "y": "6",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.95",
            "y": "5.6049999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8999999999999999",
            "y": "5.2199999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8500000000000001",
            "y": "4.8450000000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8",
            "y": "4.4800000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.75",
            "y": "4.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.7",
            "y": "3.7799999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6499999999999999",
            "y": "3.4449999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6000000000000001",
            "y": "3.120000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.55",
            "y": "2.8050000000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.5",
            "y": "2.5",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.45",
            "y": "2.2050000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3999999999999999",
            "y": "1.9199999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3500000000000001",
            "y": "1.6450000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3",
            "y": "1.3800000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.25",
            "y": "1.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.2",
            "y": "0.87999999999999989",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1499999999999999",
            "y": "0.64499999999999957",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1000000000000001",
            "y": "0.42000000000000037",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.05",
            "y": "0.20500000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1",
            "y": "0",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.95000000000000018",
            "y": "-0.1949999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.89999999999999991",
            "y": "-0.38000000000000034",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.85000000000000009",
            "y": "-0.55499999999999972",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.79999999999999982",
            "y": "-0.72000000000000064",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.75",
            "y": "-0.875",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.70000000000000018",
            "y": "-1.0199999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.64999999999999991",
            "y": "-1.1550000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.60000000000000009",
            "y": "-1.2799999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.54999999999999982",
            "y": "-1.3950000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.5",
            "y": "-1.5",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.45000000000000018",
            "y": "-1.5949999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.39999999999999991",
            "y": "-1.6800000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.35000000000000009",
            "y": "-1.7549999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.29999999999999982",
            "y": "-1.8200000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.25",
            "y": "-1.875",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.20000000000000018",
            "y": "-1.9199999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.14999999999999991",
            "y": "-1.9550000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.10000000000000009",
            "y": "-1.98",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.049999999999999822",
            "y": "-1.9950000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "0",
            "y": "-2",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.049999999999999822",
            "y": "-1.9950000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.10000000000000009",
            "y": "-1.98",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.14999999999999991",
            "y": "-1.9550000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.20000000000000018",
            "y": "-1.9199999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.25",
            "y": "-1.875",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.29999999999999982",
            "y": "-1.8200000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.35000000000000009",
            "y": "-1.7549999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.39999999999999991",
            "y": "-1.6800000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.45000000000000018",
            "y": "-1.5949999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.5",
            "y": "-1.5",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1.3950000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.60000000000000009",
            "y": "-1.2799999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.64999999999999991",
            "y": "-1.1550000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.70000000000000018",
            "y": "-1.0199999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.75",
            "y": "-0.875",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.79999999999999982",
            "y": "-0.72000000000000064",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.85000000000000009",
            "y": "-0.55499999999999972",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.89999999999999991",
            "y": "-0.38000000000000034",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.95000000000000018",
            "y": "-0.1949999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "1",
            "y": "0",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0499999999999998",
            "y": "0.20499999999999918",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0999999999999996",
            "y": "0.4199999999999986",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.1500000000000004",
            "y": "0.64500000000000179",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2000000000000002",
            "y": "0.88000000000000078",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.25",
            "y": "1.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2999999999999998",
            "y": "1.379999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.3499999999999996",
            "y": "1.6449999999999982",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4000000000000004",
            "y": "1.9200000000000021",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4500000000000002",
            "y": "2.205000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5",
            "y": "2.5",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5499999999999998",
            "y": "2.8049999999999988",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5999999999999996",
            "y": "3.1199999999999974",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.6500000000000004",
            "y": "3.4450000000000021",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7000000000000002",
            "y": "3.7800000000000011",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.75",
            "y": "4.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7999999999999998",
            "y": "4.4799999999999986",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.8499999999999996",
            "y": "4.8449999999999971",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9000000000000004",
            "y": "5.2200000000000024",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9500000000000002",
            "y": "5.6050000000000013",
            "series": "Approximate quadratic"
          },
          {
            "x": "2",
            "y": "6",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0499999999999998",
            "y": "6.4049999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0999999999999996",
            "y": "6.8199999999999967",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.1500000000000004",
            "y": "7.2450000000000028",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2000000000000002",
            "y": "7.6800000000000015",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.25",
            "y": "8.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2999999999999998",
            "y": "8.5799999999999983",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.3499999999999996",
            "y": "9.0449999999999964",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4000000000000004",
            "y": "9.5200000000000031",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4500000000000002",
            "y": "10.005000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5",
            "y": "10.5",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5499999999999998",
            "y": "11.004999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5999999999999996",
            "y": "11.519999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.6500000000000004",
            "y": "12.045000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7000000000000002",
            "y": "12.580000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.75",
            "y": "13.125",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7999999999999998",
            "y": "13.679999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.8499999999999996",
            "y": "14.244999999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9000000000000004",
            "y": "14.820000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9500000000000002",
            "y": "15.405000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "3",
            "y": "16",
            "series": "Approximate quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-bounded-interval-r/plot.svg",
        "plotSHA256": "b6a1bee3e81db819a79d0b1e4b1736fa74acdb2ec3dbec33c26a18f2a604d9b9",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-r/full-result.Rtext",
            "sha256": "a19e1d0d7a43caeaff51b681518114cbacbfe473059d3686cfa765d8aa96f05d"
          },
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-r/plot-points.csv",
            "sha256": "82aaba95a91e2a8fb82da248007222eefac04ad7dca679d3ea105a1b1ca8f701"
          },
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-r/plot.svg",
            "sha256": "b6a1bee3e81db819a79d0b1e4b1736fa74acdb2ec3dbec33c26a18f2a604d9b9"
          },
          {
            "file": "metr18-fixed-results/fieller-bounded-interval-r/summary.csv",
            "sha256": "6f3ce6576064b4ead2162a8604e6f0d00814cfc5e45b7c94a7b0b5dfb7105024"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "two-unbounded-rays": {
        "api": "fieller",
        "variant": "two-unbounded-rays",
        "language": "r",
        "codeFile": "metr18-code/fieller-two-unbounded-rays.R",
        "codeSHA256": "5685b0916967d6d9d5254add4f08ab1b591dd9ae35055fccc465cc2e2130134d",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"3\",pi=\"0\",covariance=list(list(\"1\",\"0\"),list(\"0\",\"1\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"3\",pi=\"0\",covariance=list(list(\"1\",\"0\"),list(\"0\",\"1\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "3",
          "pi": "0",
          "covariance": [
            [
              "1",
              "0"
            ],
            [
              "0",
              "1"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=-4.000000000, B=0.000000000, C=5.000000000, discriminant=80.000000000, setType=two-rays, criticalValue=4.000000000 \r\n",
        "stderr": "",
        "summary": {
          "A": "-4.000000000",
          "B": "0.000000000",
          "C": "5.000000000",
          "discriminant": "80.000000000",
          "setType": "two-rays",
          "criticalValue": "4.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "-31",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.9500000000000002",
            "y": "-29.810000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8999999999999999",
            "y": "-28.640000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8500000000000001",
            "y": "-27.490000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7999999999999998",
            "y": "-26.359999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.75",
            "y": "-25.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7000000000000002",
            "y": "-24.160000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6499999999999999",
            "y": "-23.09",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6000000000000001",
            "y": "-22.040000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5499999999999998",
            "y": "-21.009999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5",
            "y": "-20",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.4500000000000002",
            "y": "-19.010000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3999999999999999",
            "y": "-18.039999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3500000000000001",
            "y": "-17.090000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2999999999999998",
            "y": "-16.159999999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.25",
            "y": "-15.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2000000000000002",
            "y": "-14.360000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1499999999999999",
            "y": "-13.489999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1000000000000001",
            "y": "-12.640000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.0499999999999998",
            "y": "-11.809999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2",
            "y": "-11",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.95",
            "y": "-10.209999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8999999999999999",
            "y": "-9.4399999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8500000000000001",
            "y": "-8.6900000000000013",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8",
            "y": "-7.9600000000000009",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.75",
            "y": "-7.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.7",
            "y": "-6.5599999999999987",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6499999999999999",
            "y": "-5.8899999999999988",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6000000000000001",
            "y": "-5.240000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.55",
            "y": "-4.6100000000000012",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.5",
            "y": "-4",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.45",
            "y": "-3.4100000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3999999999999999",
            "y": "-2.839999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3500000000000001",
            "y": "-2.2900000000000009",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3",
            "y": "-1.7600000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.25",
            "y": "-1.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.2",
            "y": "-0.75999999999999979",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1499999999999999",
            "y": "-0.28999999999999915",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1000000000000001",
            "y": "0.15999999999999925",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.05",
            "y": "0.58999999999999986",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.95000000000000018",
            "y": "1.3899999999999988",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.89999999999999991",
            "y": "1.7600000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.85000000000000009",
            "y": "2.1099999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.79999999999999982",
            "y": "2.4400000000000013",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.75",
            "y": "2.75",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.70000000000000018",
            "y": "3.0399999999999991",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.64999999999999991",
            "y": "3.3100000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.60000000000000009",
            "y": "3.5599999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.54999999999999982",
            "y": "3.7900000000000009",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.5",
            "y": "4",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.45000000000000018",
            "y": "4.1899999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.39999999999999991",
            "y": "4.3600000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.35000000000000009",
            "y": "4.5099999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.29999999999999982",
            "y": "4.6400000000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.25",
            "y": "4.75",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.20000000000000018",
            "y": "4.8399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.14999999999999991",
            "y": "4.9100000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.10000000000000009",
            "y": "4.96",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.049999999999999822",
            "y": "4.9900000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "0",
            "y": "5",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.049999999999999822",
            "y": "4.9900000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.10000000000000009",
            "y": "4.96",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.14999999999999991",
            "y": "4.9100000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.20000000000000018",
            "y": "4.8399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.25",
            "y": "4.75",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.29999999999999982",
            "y": "4.6400000000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.35000000000000009",
            "y": "4.5099999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.39999999999999991",
            "y": "4.3600000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.45000000000000018",
            "y": "4.1899999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.5",
            "y": "4",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.54999999999999982",
            "y": "3.7900000000000009",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.60000000000000009",
            "y": "3.5599999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.64999999999999991",
            "y": "3.3100000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.70000000000000018",
            "y": "3.0399999999999991",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.75",
            "y": "2.75",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.79999999999999982",
            "y": "2.4400000000000013",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.85000000000000009",
            "y": "2.1099999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.89999999999999991",
            "y": "1.7600000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.95000000000000018",
            "y": "1.3899999999999988",
            "series": "Approximate quadratic"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0499999999999998",
            "y": "0.59000000000000163",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0999999999999996",
            "y": "0.16000000000000281",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.1500000000000004",
            "y": "-0.29000000000000359",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2000000000000002",
            "y": "-0.76000000000000156",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.25",
            "y": "-1.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2999999999999998",
            "y": "-1.759999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.3499999999999996",
            "y": "-2.2899999999999965",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4000000000000004",
            "y": "-2.8400000000000043",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4500000000000002",
            "y": "-3.4100000000000019",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5",
            "y": "-4",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5499999999999998",
            "y": "-4.6099999999999977",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5999999999999996",
            "y": "-5.2399999999999949",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.6500000000000004",
            "y": "-5.8900000000000041",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7000000000000002",
            "y": "-6.5600000000000023",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.75",
            "y": "-7.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7999999999999998",
            "y": "-7.9599999999999973",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.8499999999999996",
            "y": "-8.6899999999999942",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9000000000000004",
            "y": "-9.4400000000000048",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9500000000000002",
            "y": "-10.210000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "2",
            "y": "-11",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0499999999999998",
            "y": "-11.809999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0999999999999996",
            "y": "-12.639999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.1500000000000004",
            "y": "-13.490000000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2000000000000002",
            "y": "-14.360000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.25",
            "y": "-15.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2999999999999998",
            "y": "-16.159999999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.3499999999999996",
            "y": "-17.089999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4000000000000004",
            "y": "-18.040000000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4500000000000002",
            "y": "-19.010000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5",
            "y": "-20",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5499999999999998",
            "y": "-21.009999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5999999999999996",
            "y": "-22.039999999999992",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.6500000000000004",
            "y": "-23.090000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7000000000000002",
            "y": "-24.160000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.75",
            "y": "-25.25",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7999999999999998",
            "y": "-26.359999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.8499999999999996",
            "y": "-27.489999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9000000000000004",
            "y": "-28.640000000000008",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9500000000000002",
            "y": "-29.810000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "3",
            "y": "-31",
            "series": "Approximate quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-two-unbounded-rays-r/plot.svg",
        "plotSHA256": "c6e26834b49052154a74434a21f572239b71b978d5f874f1a26d17e420978473",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-r/full-result.Rtext",
            "sha256": "fd39959c0a7374c3006de8d4ef22c4bd639712f76d45c3fad0abc47319ec5aba"
          },
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-r/plot-points.csv",
            "sha256": "21bc99ad20277ce3b7cb70b499693ce526aba68c557c4b9ef38413602b9abffa"
          },
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-r/plot.svg",
            "sha256": "c6e26834b49052154a74434a21f572239b71b978d5f874f1a26d17e420978473"
          },
          {
            "file": "metr18-fixed-results/fieller-two-unbounded-rays-r/summary.csv",
            "sha256": "957a278174c659a554f63462c7af24d059b8d882fa8cfc7ef742727d6f518827"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "whole-real-line": {
        "api": "fieller",
        "variant": "whole-real-line",
        "language": "r",
        "codeFile": "metr18-code/fieller-whole-real-line.R",
        "codeSHA256": "bee464618814062a0cdf0139c2b63abc7aec324269fecea7c550a356a064e0e0",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"1/5\",pi=\"1/10\",covariance=list(list(\"1/25\",\"1/100\"),list(\"1/100\",\"9/100\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"1/5\",pi=\"1/10\",covariance=list(list(\"1/25\",\"1/100\"),list(\"1/100\",\"9/100\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "1/5",
          "pi": "1/10",
          "covariance": [
            [
              "1/25",
              "1/100"
            ],
            [
              "1/100",
              "9/100"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=-0.350000000, B=0.040000000, C=-0.120000000, discriminant=-0.166400000, setType=all-real, criticalValue=4.000000000 \r\n",
        "stderr": "",
        "summary": {
          "A": "-0.350000000",
          "B": "0.040000000",
          "C": "-0.120000000",
          "discriminant": "-0.166400000",
          "setType": "all-real",
          "criticalValue": "4.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "-3.3899999999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.9500000000000002",
            "y": "-3.2838750000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8999999999999999",
            "y": "-3.1795",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8500000000000001",
            "y": "-3.0768749999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7999999999999998",
            "y": "-2.9759999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.75",
            "y": "-2.8768749999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7000000000000002",
            "y": "-2.7795000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6499999999999999",
            "y": "-2.6838749999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6000000000000001",
            "y": "-2.5899999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5499999999999998",
            "y": "-2.4978749999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5",
            "y": "-2.4075000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.4500000000000002",
            "y": "-2.3188750000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3999999999999999",
            "y": "-2.2320000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3500000000000001",
            "y": "-2.1468750000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2999999999999998",
            "y": "-2.0634999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.25",
            "y": "-1.9818750000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2000000000000002",
            "y": "-1.9020000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1499999999999999",
            "y": "-1.8238749999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1000000000000001",
            "y": "-1.7475000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.0499999999999998",
            "y": "-1.6728749999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2",
            "y": "-1.6000000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.95",
            "y": "-1.5288750000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8999999999999999",
            "y": "-1.4594999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8500000000000001",
            "y": "-1.3918750000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8",
            "y": "-1.3260000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.75",
            "y": "-1.2618749999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.7",
            "y": "-1.1995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6499999999999999",
            "y": "-1.1388749999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6000000000000001",
            "y": "-1.0799999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.55",
            "y": "-1.022875",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.5",
            "y": "-0.9674999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.45",
            "y": "-0.91387499999999988",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3999999999999999",
            "y": "-0.86199999999999977",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3500000000000001",
            "y": "-0.81187500000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3",
            "y": "-0.76349999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.25",
            "y": "-0.71687500000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.2",
            "y": "-0.67200000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1499999999999999",
            "y": "-0.62887499999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1000000000000001",
            "y": "-0.58750000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.05",
            "y": "-0.547875",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1",
            "y": "-0.51000000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.95000000000000018",
            "y": "-0.47387500000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.89999999999999991",
            "y": "-0.43949999999999989",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.85000000000000009",
            "y": "-0.40687499999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.79999999999999982",
            "y": "-0.37599999999999989",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.75",
            "y": "-0.34687499999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.70000000000000018",
            "y": "-0.31950000000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.64999999999999991",
            "y": "-0.29387499999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.60000000000000009",
            "y": "-0.27000000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.54999999999999982",
            "y": "-0.2478749999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.5",
            "y": "-0.22749999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.45000000000000018",
            "y": "-0.20887500000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.39999999999999991",
            "y": "-0.19199999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.35000000000000009",
            "y": "-0.176875",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.29999999999999982",
            "y": "-0.16349999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.25",
            "y": "-0.15187499999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.20000000000000018",
            "y": "-0.14200000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.14999999999999991",
            "y": "-0.13387499999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.10000000000000009",
            "y": "-0.1275",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.049999999999999822",
            "y": "-0.12287499999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "0",
            "y": "-0.12",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.049999999999999822",
            "y": "-0.11887499999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.10000000000000009",
            "y": "-0.1195",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.14999999999999991",
            "y": "-0.12187499999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.20000000000000018",
            "y": "-0.126",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.25",
            "y": "-0.13187499999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.29999999999999982",
            "y": "-0.13949999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.35000000000000009",
            "y": "-0.14887500000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.39999999999999991",
            "y": "-0.15999999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.45000000000000018",
            "y": "-0.17287500000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.5",
            "y": "-0.1875",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.54999999999999982",
            "y": "-0.20387499999999992",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.60000000000000009",
            "y": "-0.22200000000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.64999999999999991",
            "y": "-0.24187499999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.70000000000000018",
            "y": "-0.26350000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.75",
            "y": "-0.28687499999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.79999999999999982",
            "y": "-0.31199999999999989",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.85000000000000009",
            "y": "-0.33887500000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.89999999999999991",
            "y": "-0.36749999999999994",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.95000000000000018",
            "y": "-0.39787500000000009",
            "series": "Approximate quadratic"
          },
          {
            "x": "1",
            "y": "-0.42999999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0499999999999998",
            "y": "-0.46387499999999987",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0999999999999996",
            "y": "-0.49949999999999972",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.1500000000000004",
            "y": "-0.53687500000000021",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2000000000000002",
            "y": "-0.57600000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.25",
            "y": "-0.61687500000000006",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2999999999999998",
            "y": "-0.65949999999999986",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.3499999999999996",
            "y": "-0.7038749999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4000000000000004",
            "y": "-0.75000000000000022",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4500000000000002",
            "y": "-0.79787500000000022",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5",
            "y": "-0.84749999999999992",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5499999999999998",
            "y": "-0.89887499999999976",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5999999999999996",
            "y": "-0.95199999999999962",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.6500000000000004",
            "y": "-1.0068750000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7000000000000002",
            "y": "-1.0635000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.75",
            "y": "-1.1218749999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7999999999999998",
            "y": "-1.1819999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.8499999999999996",
            "y": "-1.2438749999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9000000000000004",
            "y": "-1.3075000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9500000000000002",
            "y": "-1.3728750000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2",
            "y": "-1.4399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0499999999999998",
            "y": "-1.5088749999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0999999999999996",
            "y": "-1.5794999999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.1500000000000004",
            "y": "-1.6518750000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2000000000000002",
            "y": "-1.726",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.25",
            "y": "-1.8018749999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2999999999999998",
            "y": "-1.8794999999999997",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.3499999999999996",
            "y": "-1.9588749999999995",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4000000000000004",
            "y": "-2.0400000000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4500000000000002",
            "y": "-2.1228750000000005",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5",
            "y": "-2.2075",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5499999999999998",
            "y": "-2.2938749999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5999999999999996",
            "y": "-2.3819999999999992",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.6500000000000004",
            "y": "-2.4718750000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7000000000000002",
            "y": "-2.5634999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.75",
            "y": "-2.6568749999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7999999999999998",
            "y": "-2.7519999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.8499999999999996",
            "y": "-2.8488749999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9000000000000004",
            "y": "-2.9475000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9500000000000002",
            "y": "-3.0478750000000003",
            "series": "Approximate quadratic"
          },
          {
            "x": "3",
            "y": "-3.1499999999999995",
            "series": "Approximate quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-whole-real-line-r/plot.svg",
        "plotSHA256": "5aefbca57a9add13d53e081d6781690de37ff1eee48d8823518f7768cbbd5613",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-r/full-result.Rtext",
            "sha256": "9217f3d081b8432cc4ceda65036674c8815d31d53036092436b76d2da1e9a07d"
          },
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-r/plot-points.csv",
            "sha256": "a7f6ee9fb50ebc07a7911e4cd283b1b33bd7fd6cccb5c5a91d3041f72810cf0e"
          },
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-r/plot.svg",
            "sha256": "5aefbca57a9add13d53e081d6781690de37ff1eee48d8823518f7768cbbd5613"
          },
          {
            "file": "metr18-fixed-results/fieller-whole-real-line-r/summary.csv",
            "sha256": "92a681dba2210aacd9fe6beff6171aa30119431d6eaef78cbd81e38916828cfb"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "linear-half-line": {
        "api": "fieller",
        "variant": "linear-half-line",
        "language": "r",
        "codeFile": "metr18-code/fieller-linear-half-line.R",
        "codeSHA256": "0e5805856d6cd5c7a4ece9efd433fe3cb51162d0eb878d87f10de5a61688faef",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"1\",pi=\"2\",covariance=list(list(\"1\",\"0\"),list(\"0\",\"1\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"1\",pi=\"2\",covariance=list(list(\"1\",\"0\"),list(\"0\",\"1\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "1",
          "pi": "2",
          "covariance": [
            [
              "1",
              "0"
            ],
            [
              "0",
              "1"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "A=0.000000000, B=-4.000000000, C=-3.000000000, discriminant=16.000000000, setType=right-half-line, criticalValue=4.000000000 \r\n",
        "stderr": "",
        "summary": {
          "A": "0.000000000",
          "B": "-4.000000000",
          "C": "-3.000000000",
          "discriminant": "16.000000000",
          "setType": "right-half-line",
          "criticalValue": "4.000000000"
        },
        "plotPoints": [
          {
            "x": "-3",
            "y": "9",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.9500000000000002",
            "y": "8.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8999999999999999",
            "y": "8.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.8500000000000001",
            "y": "8.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7999999999999998",
            "y": "8.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.75",
            "y": "8",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.7000000000000002",
            "y": "7.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6499999999999999",
            "y": "7.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.6000000000000001",
            "y": "7.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5499999999999998",
            "y": "7.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.5",
            "y": "7",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.4500000000000002",
            "y": "6.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3999999999999999",
            "y": "6.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.3500000000000001",
            "y": "6.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2999999999999998",
            "y": "6.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.25",
            "y": "6",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.2000000000000002",
            "y": "5.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1499999999999999",
            "y": "5.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.1000000000000001",
            "y": "5.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2.0499999999999998",
            "y": "5.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "-2",
            "y": "5",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.95",
            "y": "4.7999999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8999999999999999",
            "y": "4.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8500000000000001",
            "y": "4.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.8",
            "y": "4.2000000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.75",
            "y": "4",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.7",
            "y": "3.7999999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6499999999999999",
            "y": "3.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.6000000000000001",
            "y": "3.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.55",
            "y": "3.2000000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.5",
            "y": "3",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.45",
            "y": "2.7999999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3999999999999999",
            "y": "2.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3500000000000001",
            "y": "2.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.3",
            "y": "2.2000000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.25",
            "y": "2",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.2",
            "y": "1.7999999999999998",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1499999999999999",
            "y": "1.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.1000000000000001",
            "y": "1.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1.05",
            "y": "1.2000000000000002",
            "series": "Approximate quadratic"
          },
          {
            "x": "-1",
            "y": "1",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.95000000000000018",
            "y": "0.80000000000000071",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.89999999999999991",
            "y": "0.59999999999999964",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.85000000000000009",
            "y": "0.40000000000000036",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.79999999999999982",
            "y": "0.19999999999999929",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.75",
            "y": "0",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.70000000000000018",
            "y": "-0.19999999999999929",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.64999999999999991",
            "y": "-0.40000000000000036",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.60000000000000009",
            "y": "-0.59999999999999964",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.54999999999999982",
            "y": "-0.80000000000000071",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.5",
            "y": "-1",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.45000000000000018",
            "y": "-1.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.39999999999999991",
            "y": "-1.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.35000000000000009",
            "y": "-1.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.29999999999999982",
            "y": "-1.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.25",
            "y": "-2",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.20000000000000018",
            "y": "-2.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.14999999999999991",
            "y": "-2.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.10000000000000009",
            "y": "-2.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "-0.049999999999999822",
            "y": "-2.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "0",
            "y": "-3",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.049999999999999822",
            "y": "-3.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.10000000000000009",
            "y": "-3.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.14999999999999991",
            "y": "-3.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.20000000000000018",
            "y": "-3.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.25",
            "y": "-4",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.29999999999999982",
            "y": "-4.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.35000000000000009",
            "y": "-4.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.39999999999999991",
            "y": "-4.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.45000000000000018",
            "y": "-4.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.5",
            "y": "-5",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.54999999999999982",
            "y": "-5.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.60000000000000009",
            "y": "-5.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.64999999999999991",
            "y": "-5.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.70000000000000018",
            "y": "-5.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.75",
            "y": "-6",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.79999999999999982",
            "y": "-6.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.85000000000000009",
            "y": "-6.4000000000000004",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.89999999999999991",
            "y": "-6.5999999999999996",
            "series": "Approximate quadratic"
          },
          {
            "x": "0.95000000000000018",
            "y": "-6.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "1",
            "y": "-7",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0499999999999998",
            "y": "-7.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.0999999999999996",
            "y": "-7.3999999999999986",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.1500000000000004",
            "y": "-7.6000000000000014",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2000000000000002",
            "y": "-7.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.25",
            "y": "-8",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.2999999999999998",
            "y": "-8.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.3499999999999996",
            "y": "-8.3999999999999986",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4000000000000004",
            "y": "-8.6000000000000014",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.4500000000000002",
            "y": "-8.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5",
            "y": "-9",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5499999999999998",
            "y": "-9.1999999999999993",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.5999999999999996",
            "y": "-9.3999999999999986",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.6500000000000004",
            "y": "-9.6000000000000014",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7000000000000002",
            "y": "-9.8000000000000007",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.75",
            "y": "-10",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.7999999999999998",
            "y": "-10.199999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.8499999999999996",
            "y": "-10.399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9000000000000004",
            "y": "-10.600000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "1.9500000000000002",
            "y": "-10.800000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2",
            "y": "-11",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0499999999999998",
            "y": "-11.199999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.0999999999999996",
            "y": "-11.399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.1500000000000004",
            "y": "-11.600000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2000000000000002",
            "y": "-11.800000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.25",
            "y": "-12",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.2999999999999998",
            "y": "-12.199999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.3499999999999996",
            "y": "-12.399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4000000000000004",
            "y": "-12.600000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.4500000000000002",
            "y": "-12.800000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5",
            "y": "-13",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5499999999999998",
            "y": "-13.199999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.5999999999999996",
            "y": "-13.399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.6500000000000004",
            "y": "-13.600000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7000000000000002",
            "y": "-13.800000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.75",
            "y": "-14",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.7999999999999998",
            "y": "-14.199999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.8499999999999996",
            "y": "-14.399999999999999",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9000000000000004",
            "y": "-14.600000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "2.9500000000000002",
            "y": "-14.800000000000001",
            "series": "Approximate quadratic"
          },
          {
            "x": "3",
            "y": "-15",
            "series": "Approximate quadratic"
          }
        ],
        "plotFile": "metr18-fixed-results/fieller-linear-half-line-r/plot.svg",
        "plotSHA256": "052fd8236e262b4e59a4fa340c3643efb29bdf99d4fcbe8df2fc8a48be745e11",
        "files": [
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-r/full-result.Rtext",
            "sha256": "fea0fd8197e5e6a5dbde22b3b239f70037cc608f69ff496e386c83e5d9324d08"
          },
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-r/plot-points.csv",
            "sha256": "0456c64aa30503cb2aba990bc0fafe2cb37896d6c011562e6f65df92c30d9373"
          },
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-r/plot.svg",
            "sha256": "052fd8236e262b4e59a4fa340c3643efb29bdf99d4fcbe8df2fc8a48be745e11"
          },
          {
            "file": "metr18-fixed-results/fieller-linear-half-line-r/summary.csv",
            "sha256": "ca96c8b40b6c4800781d56f7a8b95197b93de0cfa80ebf3ca5cd0d2be5b5ded7"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "reject-singular-covariance": {
        "api": "fieller",
        "variant": "reject-singular-covariance",
        "language": "r",
        "codeFile": "metr18-code/fieller-reject-singular-covariance.R",
        "codeSHA256": "c674f3c9bcb7603178e8d8cb53ce2934e33f35757005bb45facd1800ad36b092",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"1\",pi=\"1\",covariance=list(list(\"1\",\"1\"),list(\"1\",\"1\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"fieller\"\nINPUT=list(delta=\"1\",pi=\"1\",covariance=list(list(\"1\",\"1\"),list(\"1\",\"1\")),criticalValue=\"4\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "delta": "1",
          "pi": "1",
          "covariance": [
            [
              "1",
              "1"
            ],
            [
              "1",
              "1"
            ]
          ],
          "criticalValue": "4"
        },
        "inputFiles": [],
        "returnCode": 2,
        "expectedFailure": true,
        "stdout": "",
        "stderr": "Rejected fixed input:  Fieller requires PD covariance \r\n",
        "summary": {},
        "plotPoints": [],
        "plotFile": null,
        "plotSHA256": null,
        "files": [],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    }
  },
  "overid": {
    "python": {
      "refit-optimal-weight": {
        "api": "overid",
        "variant": "refit-optimal-weight",
        "language": "python",
        "codeFile": "metr18-code/overid-refit-optimal-weight.py",
        "codeSHA256": "78acf8adf7d92a639dbee341e42a2dbd2026ae56dde5a9c85323f8dba8766165",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='overid'\nINPUT={'rows': [{'id': 'a', 'y': '1', 'x': '0', 'z': ['-1', '-1']}, {'id': 'b', 'y': '0', 'x': '1', 'z': ['-1', '0']}, {'id': 'c', 'y': '2', 'x': '0', 'z': ['0', '-1']}, {'id': 'd', 'y': '3', 'x': '2', 'z': ['0', '1']}, {'id': 'e', 'y': '2', 'x': '2', 'z': ['1', '0']}, {'id': 'f', 'y': '5', 'x': '3', 'z': ['1', '1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='overid'\nINPUT={'rows': [{'id': 'a', 'y': '1', 'x': '0', 'z': ['-1', '-1']}, {'id': 'b', 'y': '0', 'x': '1', 'z': ['-1', '0']}, {'id': 'c', 'y': '2', 'x': '0', 'z': ['0', '-1']}, {'id': 'd', 'y': '3', 'x': '2', 'z': ['0', '1']}, {'id': 'e', 'y': '2', 'x': '2', 'z': ['1', '0']}, {'id': 'f', 'y': '5', 'x': '3', 'z': ['1', '1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "1",
              "x": "0",
              "z": [
                "-1",
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "0",
              "x": "1",
              "z": [
                "-1",
                "0"
              ]
            },
            {
              "id": "c",
              "y": "2",
              "x": "0",
              "z": [
                "0",
                "-1"
              ]
            },
            {
              "id": "d",
              "y": "3",
              "x": "2",
              "z": [
                "0",
                "1"
              ]
            },
            {
              "id": "e",
              "y": "2",
              "x": "2",
              "z": [
                "1",
                "0"
              ]
            },
            {
              "id": "f",
              "y": "5",
              "x": "3",
              "z": [
                "1",
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta1=1.142857143, beta2=1.097073850, J=0.758631367, referenceDF=1.000000000, testApplicable=1.000000000\r\n",
        "stderr": "",
        "summary": {
          "beta1": "1.142857143",
          "beta2": "1.097073850",
          "J": "0.758631367",
          "referenceDF": "1.000000000",
          "testApplicable": "1.000000000"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "5664400/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-9/10",
            "y": "128652391/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-4/5",
            "y": "116327764/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-7/10",
            "y": "104636119/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-3/5",
            "y": "93577456/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-1/2",
            "y": "3326071/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-2/5",
            "y": "73359076/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-3/10",
            "y": "64199359/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-1/5",
            "y": "55672624/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-1/10",
            "y": "47778871/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0",
            "y": "1620724/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1/10",
            "y": "33890311/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1/5",
            "y": "27895504/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3/10",
            "y": "22533679/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2/5",
            "y": "17804836/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1/2",
            "y": "548359/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3/5",
            "y": "10246096/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7/10",
            "y": "7416199/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4/5",
            "y": "5219284/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "9/10",
            "y": "3655351/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1",
            "y": "108976/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "11/10",
            "y": "2426431/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6/5",
            "y": "2761444/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "13/10",
            "y": "3729439/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7/5",
            "y": "5330416/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3/2",
            "y": "302575/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "8/5",
            "y": "10431316/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "17/10",
            "y": "13931239/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "9/5",
            "y": "18064144/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "19/10",
            "y": "22830031/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2",
            "y": "1129156/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "21/10",
            "y": "34260751/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "11/5",
            "y": "40925584/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "23/10",
            "y": "48223399/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "12/5",
            "y": "56154196/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5/2",
            "y": "2588719/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "13/5",
            "y": "73914736/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "27/10",
            "y": "83744479/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "14/5",
            "y": "94207204/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "29/10",
            "y": "105302911/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3",
            "y": "4681264/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "31/10",
            "y": "129393271/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "16/5",
            "y": "142387924/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "33/10",
            "y": "156015559/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "17/5",
            "y": "170276176/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7/2",
            "y": "7406791/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "18/5",
            "y": "200696356/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "37/10",
            "y": "216855919/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "19/5",
            "y": "233648464/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "39/10",
            "y": "251073991/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4",
            "y": "10765300/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "41/10",
            "y": "287823991/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "21/5",
            "y": "307148464/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "43/10",
            "y": "327105919/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "22/5",
            "y": "347696356/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "9/2",
            "y": "14756791/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "23/5",
            "y": "390776176/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "47/10",
            "y": "413265559/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "24/5",
            "y": "436387924/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "49/10",
            "y": "460143271/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5",
            "y": "19381264/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "51/10",
            "y": "509552911/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "26/5",
            "y": "535207204/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "53/10",
            "y": "561494479/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "27/5",
            "y": "588414736/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "11/2",
            "y": "24638719/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "28/5",
            "y": "644154196/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "57/10",
            "y": "672973399/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "29/5",
            "y": "702425584/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "59/10",
            "y": "732510751/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6",
            "y": "30529156/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "61/10",
            "y": "794580031/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "31/5",
            "y": "826564144/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "63/10",
            "y": "859181239/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "32/5",
            "y": "892431316/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "13/2",
            "y": "37052575/127923",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "33/5",
            "y": "960830416/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "67/10",
            "y": "995979439/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "34/5",
            "y": "1031761444/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "69/10",
            "y": "1068176431/3198075",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7",
            "y": "44208976/127923",
            "series": "Fixed-weight criterion"
          }
        ],
        "plotFile": "metr18-fixed-results/overid-refit-optimal-weight-python/plot.svg",
        "plotSHA256": "62ff5627a8560cca536622e5d621d131cdfda1504b52718b3f24bd041d43787f",
        "files": [
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-python/full.json",
            "sha256": "b03a91e2f6d89385f0e1b1e2038c414ffb497fb6bc1fe05d8c983e894a7615f9"
          },
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-python/plot-points.csv",
            "sha256": "ca1fdc69e667a0649495b8912cd85ec46077589c47f69905d6ad745ad6c6032c"
          },
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-python/plot.svg",
            "sha256": "62ff5627a8560cca536622e5d621d131cdfda1504b52718b3f24bd041d43787f"
          },
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-python/summary.csv",
            "sha256": "6fa11afe5f174d26c89e4bbf4cc204d5e52837cd457ccdf8df4ab878054896b4"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "exactly-identified-no-J-test": {
        "api": "overid",
        "variant": "exactly-identified-no-J-test",
        "language": "python",
        "codeFile": "metr18-code/overid-exactly-identified-no-J-test.py",
        "codeSHA256": "de075f0b42b1ea994064a1feceafcbdfd11a5869eca1154e045c2e88a6c645df",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='overid'\nINPUT={'rows': [{'id': 'a', 'y': '0', 'x': '0', 'z': ['-1']}, {'id': 'b', 'y': '1', 'x': '1', 'z': ['-1']}, {'id': 'c', 'y': '3', 'x': '1', 'z': ['1']}, {'id': 'd', 'y': '4', 'x': '2', 'z': ['1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='overid'\nINPUT={'rows': [{'id': 'a', 'y': '0', 'x': '0', 'z': ['-1']}, {'id': 'b', 'y': '1', 'x': '1', 'z': ['-1']}, {'id': 'c', 'y': '3', 'x': '1', 'z': ['1']}, {'id': 'd', 'y': '4', 'x': '2', 'z': ['1']}]}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "0",
              "x": "0",
              "z": [
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "1",
              "x": "1",
              "z": [
                "-1"
              ]
            },
            {
              "id": "c",
              "y": "3",
              "x": "1",
              "z": [
                "1"
              ]
            },
            {
              "id": "d",
              "y": "4",
              "x": "2",
              "z": [
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta1=3.000000000, beta2=3.000000000, J=0.000000000, referenceDF=0.000000000, testApplicable=0.000000000\r\n",
        "stderr": "",
        "summary": {
          "beta1": "3.000000000",
          "beta2": "3.000000000",
          "J": "0.000000000",
          "referenceDF": "0.000000000",
          "testApplicable": "0.000000000"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "16",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-9/10",
            "y": "1521/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-4/5",
            "y": "361/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-7/10",
            "y": "1369/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-3/5",
            "y": "324/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-1/2",
            "y": "49/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-2/5",
            "y": "289/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-3/10",
            "y": "1089/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-1/5",
            "y": "256/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-1/10",
            "y": "961/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0",
            "y": "9",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1/10",
            "y": "841/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1/5",
            "y": "196/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3/10",
            "y": "729/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2/5",
            "y": "169/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1/2",
            "y": "25/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3/5",
            "y": "144/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7/10",
            "y": "529/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4/5",
            "y": "121/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "9/10",
            "y": "441/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1",
            "y": "4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "11/10",
            "y": "361/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6/5",
            "y": "81/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "13/10",
            "y": "289/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7/5",
            "y": "64/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3/2",
            "y": "9/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "8/5",
            "y": "49/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "17/10",
            "y": "169/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "9/5",
            "y": "36/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "19/10",
            "y": "121/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2",
            "y": "1",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "21/10",
            "y": "81/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "11/5",
            "y": "16/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "23/10",
            "y": "49/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "12/5",
            "y": "9/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5/2",
            "y": "1/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "13/5",
            "y": "4/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "27/10",
            "y": "9/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "14/5",
            "y": "1/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "29/10",
            "y": "1/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3",
            "y": "0",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "31/10",
            "y": "1/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "16/5",
            "y": "1/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "33/10",
            "y": "9/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "17/5",
            "y": "4/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7/2",
            "y": "1/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "18/5",
            "y": "9/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "37/10",
            "y": "49/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "19/5",
            "y": "16/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "39/10",
            "y": "81/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4",
            "y": "1",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "41/10",
            "y": "121/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "21/5",
            "y": "36/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "43/10",
            "y": "169/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "22/5",
            "y": "49/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "9/2",
            "y": "9/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "23/5",
            "y": "64/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "47/10",
            "y": "289/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "24/5",
            "y": "81/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "49/10",
            "y": "361/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5",
            "y": "4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "51/10",
            "y": "441/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "26/5",
            "y": "121/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "53/10",
            "y": "529/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "27/5",
            "y": "144/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "11/2",
            "y": "25/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "28/5",
            "y": "169/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "57/10",
            "y": "729/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "29/5",
            "y": "196/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "59/10",
            "y": "841/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6",
            "y": "9",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "61/10",
            "y": "961/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "31/5",
            "y": "256/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "63/10",
            "y": "1089/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "32/5",
            "y": "289/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "13/2",
            "y": "49/4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "33/5",
            "y": "324/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "67/10",
            "y": "1369/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "34/5",
            "y": "361/25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "69/10",
            "y": "1521/100",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7",
            "y": "16",
            "series": "Fixed-weight criterion"
          }
        ],
        "plotFile": "metr18-fixed-results/overid-exactly-identified-no-J-test-python/plot.svg",
        "plotSHA256": "c550f07889fdcf9b94d5357b8dc2254a33b02a899343cf87cc0457d5ee609b42",
        "files": [
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-python/full.json",
            "sha256": "ec30c28d9cf78114f69b2f13cd9492e621e4ed2c99b3536c570ff251957ca62a"
          },
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-python/plot-points.csv",
            "sha256": "8d393b3215e48f5f9f865d13e87f604de3cbc94fe2f1affbc3ed6cdbb3bbe1dc"
          },
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-python/plot.svg",
            "sha256": "c550f07889fdcf9b94d5357b8dc2254a33b02a899343cf87cc0457d5ee609b42"
          },
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-python/summary.csv",
            "sha256": "d8cef7fe0bb8c2b8629c21b3ac85116473d1db496aabcd79e8b76790b5cf9c97"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    },
    "r": {
      "refit-optimal-weight": {
        "api": "overid",
        "variant": "refit-optimal-weight",
        "language": "r",
        "codeFile": "metr18-code/overid-refit-optimal-weight.R",
        "codeSHA256": "b9c579489cc7320e780eeb3f9000d48f32b104dbe6bc21382d3bf805f982c062",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"overid\"\nINPUT=list(rows=list(list(id=\"a\",y=\"1\",x=\"0\",z=list(\"-1\",\"-1\")),list(id=\"b\",y=\"0\",x=\"1\",z=list(\"-1\",\"0\")),list(id=\"c\",y=\"2\",x=\"0\",z=list(\"0\",\"-1\")),list(id=\"d\",y=\"3\",x=\"2\",z=list(\"0\",\"1\")),list(id=\"e\",y=\"2\",x=\"2\",z=list(\"1\",\"0\")),list(id=\"f\",y=\"5\",x=\"3\",z=list(\"1\",\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"overid\"\nINPUT=list(rows=list(list(id=\"a\",y=\"1\",x=\"0\",z=list(\"-1\",\"-1\")),list(id=\"b\",y=\"0\",x=\"1\",z=list(\"-1\",\"0\")),list(id=\"c\",y=\"2\",x=\"0\",z=list(\"0\",\"-1\")),list(id=\"d\",y=\"3\",x=\"2\",z=list(\"0\",\"1\")),list(id=\"e\",y=\"2\",x=\"2\",z=list(\"1\",\"0\")),list(id=\"f\",y=\"5\",x=\"3\",z=list(\"1\",\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "1",
              "x": "0",
              "z": [
                "-1",
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "0",
              "x": "1",
              "z": [
                "-1",
                "0"
              ]
            },
            {
              "id": "c",
              "y": "2",
              "x": "0",
              "z": [
                "0",
                "-1"
              ]
            },
            {
              "id": "d",
              "y": "3",
              "x": "2",
              "z": [
                "0",
                "1"
              ]
            },
            {
              "id": "e",
              "y": "2",
              "x": "2",
              "z": [
                "1",
                "0"
              ]
            },
            {
              "id": "f",
              "y": "5",
              "x": "3",
              "z": [
                "1",
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta1=1.142857143, beta2=1.097073850, J=0.758631367, referenceDF=1.000000000, testApplicable=1.000000000 \r\n",
        "stderr": "",
        "summary": {
          "beta1": "1.142857143",
          "beta2": "1.097073850",
          "J": "0.758631367",
          "referenceDF": "1.000000000",
          "testApplicable": "1.000000000"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "44.279762044354797",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.90000000000000002",
            "y": "40.228071886994513",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.80000000000000004",
            "y": "36.374307669457394",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.69999999999999996",
            "y": "32.718469391743469",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.59999999999999998",
            "y": "29.2605570538527",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.5",
            "y": "26.000570655785118",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.40000000000000002",
            "y": "22.938510197540705",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.30000000000000004",
            "y": "20.07437567911947",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.19999999999999996",
            "y": "17.408167100521403",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.09999999999999998",
            "y": "14.939884461746521",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0",
            "y": "12.669527762794806",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.10000000000000009",
            "y": "10.597097003666264",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.19999999999999996",
            "y": "8.722592184360904",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.30000000000000004",
            "y": "7.0460133048787155",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.39999999999999991",
            "y": "5.5673603652197041",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.5",
            "y": "4.2866333653838637",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.60000000000000009",
            "y": "3.2038323053711988",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.69999999999999996",
            "y": "2.318957185181711",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.80000000000000004",
            "y": "1.6320080048153964",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.89999999999999991",
            "y": "1.1429847642722579",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1",
            "y": "0.85188746355229317",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.1000000000000001",
            "y": "0.7587161026555036",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.2000000000000002",
            "y": "0.86347068158188933",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.2999999999999998",
            "y": "1.1661512003314483",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.3999999999999999",
            "y": "1.6667576589041841",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.5",
            "y": "2.3652900573000939",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.6000000000000001",
            "y": "3.2617483955191795",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.7000000000000002",
            "y": "4.3561326735614392",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.7999999999999998",
            "y": "5.6484428914268694",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.8999999999999999",
            "y": "7.1386790491154812",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2",
            "y": "8.8268411466272667",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.1000000000000001",
            "y": "10.712929183962226",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.2000000000000002",
            "y": "12.796943161120367",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.2999999999999998",
            "y": "15.078883078101669",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.3999999999999999",
            "y": "17.558748934906152",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.5",
            "y": "20.236540731533808",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.6000000000000001",
            "y": "23.112258467984653",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.7000000000000002",
            "y": "26.185902144258659",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.7999999999999998",
            "y": "29.45747176035583",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.8999999999999999",
            "y": "32.92696731627619",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3",
            "y": "36.594388812019716",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.0999999999999996",
            "y": "40.45973624758642",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.2000000000000002",
            "y": "44.523009622976318",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.2999999999999998",
            "y": "48.784208938189359",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.4000000000000004",
            "y": "53.243334193225614",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.5",
            "y": "57.900385388084999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.5999999999999996",
            "y": "62.75536252276757",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.7000000000000002",
            "y": "67.808265597273376",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.7999999999999998",
            "y": "73.059094611602291",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.9000000000000004",
            "y": "78.507849565754398",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4",
            "y": "84.154530459729656",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.0999999999999996",
            "y": "89.999137293528094",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.2000000000000002",
            "y": "96.041670067149752",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.2999999999999998",
            "y": "102.28212878059456",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.4000000000000004",
            "y": "108.72051343386258",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.5",
            "y": "115.35682402695369",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.5999999999999996",
            "y": "122.19106055986801",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.7000000000000002",
            "y": "129.22322303260552",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.7999999999999998",
            "y": "136.45331144516621",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.9000000000000004",
            "y": "143.88132579755006",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5",
            "y": "151.50726608975711",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.0999999999999996",
            "y": "159.33113232178732",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.2000000000000002",
            "y": "167.3529244936407",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.2999999999999998",
            "y": "175.57264260531721",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.4000000000000004",
            "y": "183.99028665681698",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.5",
            "y": "192.60585664813988",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.5999999999999996",
            "y": "201.41935257928588",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.7000000000000002",
            "y": "210.4307744502552",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.7999999999999998",
            "y": "219.64012226104759",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.9000000000000004",
            "y": "229.04739601166324",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6",
            "y": "238.65259570210202",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.0999999999999996",
            "y": "248.45572133236399",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.2000000000000002",
            "y": "258.45677290244907",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.2999999999999998",
            "y": "268.65575041235735",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.4000000000000004",
            "y": "279.05265386208885",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.5",
            "y": "289.64748325164351",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.5999999999999996",
            "y": "300.44023858102133",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.7000000000000002",
            "y": "311.43091985022232",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.7999999999999998",
            "y": "322.61952705924648",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.9000000000000004",
            "y": "334.00606020809386",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7",
            "y": "345.59051929676434",
            "series": "Fixed-weight criterion"
          }
        ],
        "plotFile": "metr18-fixed-results/overid-refit-optimal-weight-r/plot.svg",
        "plotSHA256": "28b77d1cdf2cb1056c93f6caf518631708775d8b88b97141df9d2e8d5a4b92b4",
        "files": [
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-r/full-result.Rtext",
            "sha256": "f17ba79733b007ea099fdf027bc0efc17d2aabdb62fc19cc868ccaf03cefe1ab"
          },
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-r/plot-points.csv",
            "sha256": "b0ced9681d8099fa9dfa9748b82aeb11ac183a3db3958b12e4a3f4c19ac714b4"
          },
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-r/plot.svg",
            "sha256": "28b77d1cdf2cb1056c93f6caf518631708775d8b88b97141df9d2e8d5a4b92b4"
          },
          {
            "file": "metr18-fixed-results/overid-refit-optimal-weight-r/summary.csv",
            "sha256": "3218421304c239af5bb6d734b58b2866ecff92ef0540b933b0c6d54163fb9731"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "exactly-identified-no-J-test": {
        "api": "overid",
        "variant": "exactly-identified-no-J-test",
        "language": "r",
        "codeFile": "metr18-code/overid-exactly-identified-no-J-test.R",
        "codeSHA256": "b437bfabcccb03f99f1837ddfcf9e48e319a449dcfea24909a6da51c4bc16684",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"overid\"\nINPUT=list(rows=list(list(id=\"a\",y=\"0\",x=\"0\",z=list(\"-1\")),list(id=\"b\",y=\"1\",x=\"1\",z=list(\"-1\")),list(id=\"c\",y=\"3\",x=\"1\",z=list(\"1\")),list(id=\"d\",y=\"4\",x=\"2\",z=list(\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"overid\"\nINPUT=list(rows=list(list(id=\"a\",y=\"0\",x=\"0\",z=list(\"-1\")),list(id=\"b\",y=\"1\",x=\"1\",z=list(\"-1\")),list(id=\"c\",y=\"3\",x=\"1\",z=list(\"1\")),list(id=\"d\",y=\"4\",x=\"2\",z=list(\"1\"))))\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "rows": [
            {
              "id": "a",
              "y": "0",
              "x": "0",
              "z": [
                "-1"
              ]
            },
            {
              "id": "b",
              "y": "1",
              "x": "1",
              "z": [
                "-1"
              ]
            },
            {
              "id": "c",
              "y": "3",
              "x": "1",
              "z": [
                "1"
              ]
            },
            {
              "id": "d",
              "y": "4",
              "x": "2",
              "z": [
                "1"
              ]
            }
          ]
        },
        "inputFiles": [],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "beta1=3.000000000, beta2=3.000000000, J=0.000000000, referenceDF=0.000000000, testApplicable=0.000000000 \r\n",
        "stderr": "",
        "summary": {
          "beta1": "3.000000000",
          "beta2": "3.000000000",
          "J": "0.000000000",
          "referenceDF": "0.000000000",
          "testApplicable": "0.000000000"
        },
        "plotPoints": [
          {
            "x": "-1",
            "y": "16",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.90000000000000002",
            "y": "15.210000000000003",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.80000000000000004",
            "y": "14.44",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.69999999999999996",
            "y": "13.690000000000001",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.59999999999999998",
            "y": "12.959999999999997",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.5",
            "y": "12.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.40000000000000002",
            "y": "11.560000000000002",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.30000000000000004",
            "y": "10.889999999999999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.19999999999999996",
            "y": "10.240000000000002",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "-0.09999999999999998",
            "y": "9.6099999999999977",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0",
            "y": "9",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.10000000000000009",
            "y": "8.4100000000000001",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.19999999999999996",
            "y": "7.839999999999999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.30000000000000004",
            "y": "7.2900000000000009",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.39999999999999991",
            "y": "6.7600000000000007",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.5",
            "y": "6.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.60000000000000009",
            "y": "5.7599999999999998",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.69999999999999996",
            "y": "5.2899999999999991",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.80000000000000004",
            "y": "4.8400000000000007",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "0.89999999999999991",
            "y": "4.4100000000000001",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1",
            "y": "4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.1000000000000001",
            "y": "3.6099999999999999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.2000000000000002",
            "y": "3.2399999999999993",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.2999999999999998",
            "y": "2.8900000000000006",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.3999999999999999",
            "y": "2.5600000000000005",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.5",
            "y": "2.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.6000000000000001",
            "y": "1.9599999999999997",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.7000000000000002",
            "y": "1.6899999999999995",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.7999999999999998",
            "y": "1.4400000000000004",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "1.8999999999999999",
            "y": "1.2100000000000002",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2",
            "y": "1",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.1000000000000001",
            "y": "0.80999999999999983",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.2000000000000002",
            "y": "0.63999999999999968",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.2999999999999998",
            "y": "0.49000000000000027",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.3999999999999999",
            "y": "0.3600000000000001",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.5",
            "y": "0.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.6000000000000001",
            "y": "0.15999999999999992",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.7000000000000002",
            "y": "0.0899999999999999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.7999999999999998",
            "y": "0.04000000000000007",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "2.8999999999999999",
            "y": "0.010000000000000018",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3",
            "y": "0",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.0999999999999996",
            "y": "0.0099999999999999291",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.2000000000000002",
            "y": "0.04000000000000007",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.2999999999999998",
            "y": "0.0899999999999999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.4000000000000004",
            "y": "0.16000000000000028",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.5",
            "y": "0.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.5999999999999996",
            "y": "0.3599999999999996",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.7000000000000002",
            "y": "0.49000000000000027",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.7999999999999998",
            "y": "0.63999999999999968",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "3.9000000000000004",
            "y": "0.81000000000000061",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4",
            "y": "1",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.0999999999999996",
            "y": "1.2099999999999993",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.2000000000000002",
            "y": "1.4400000000000004",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.2999999999999998",
            "y": "1.6899999999999995",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.4000000000000004",
            "y": "1.9600000000000011",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.5",
            "y": "2.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.5999999999999996",
            "y": "2.5599999999999987",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.7000000000000002",
            "y": "2.8900000000000006",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.7999999999999998",
            "y": "3.2399999999999993",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "4.9000000000000004",
            "y": "3.6100000000000012",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5",
            "y": "4",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.0999999999999996",
            "y": "4.4099999999999984",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.2000000000000002",
            "y": "4.8400000000000007",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.2999999999999998",
            "y": "5.2899999999999991",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.4000000000000004",
            "y": "5.7600000000000016",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.5",
            "y": "6.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.5999999999999996",
            "y": "6.759999999999998",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.7000000000000002",
            "y": "7.2900000000000009",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.7999999999999998",
            "y": "7.839999999999999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "5.9000000000000004",
            "y": "8.4100000000000019",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6",
            "y": "9",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.0999999999999996",
            "y": "9.6099999999999977",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.2000000000000002",
            "y": "10.240000000000002",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.2999999999999998",
            "y": "10.889999999999999",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.4000000000000004",
            "y": "11.560000000000002",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.5",
            "y": "12.25",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.5999999999999996",
            "y": "12.959999999999997",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.7000000000000002",
            "y": "13.690000000000001",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.7999999999999998",
            "y": "14.44",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "6.9000000000000004",
            "y": "15.210000000000003",
            "series": "Fixed-weight criterion"
          },
          {
            "x": "7",
            "y": "16",
            "series": "Fixed-weight criterion"
          }
        ],
        "plotFile": "metr18-fixed-results/overid-exactly-identified-no-J-test-r/plot.svg",
        "plotSHA256": "3c861ea74ca12f03507de10e9ab9b04602ad5bf444864dd5107c70cfb73ea549",
        "files": [
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-r/full-result.Rtext",
            "sha256": "5a2a90087fc224e65c1621757d1db6596ab5bfe68efe8d6766c344bd357eff20"
          },
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-r/plot-points.csv",
            "sha256": "2c17d00836d4759d8d41b138ccb3476e8497c9a01ee078926b26c2465f992452"
          },
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-r/plot.svg",
            "sha256": "3c861ea74ca12f03507de10e9ab9b04602ad5bf444864dd5107c70cfb73ea549"
          },
          {
            "file": "metr18-fixed-results/overid-exactly-identified-no-J-test-r/summary.csv",
            "sha256": "c5eceea60a01b02a42113d4e057fa9823104a19e3439005b08fd396ad79be39e"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    }
  },
  "realdata": {
    "python": {
      "country": {
        "api": "realdata",
        "variant": "country",
        "language": "python",
        "codeFile": "metr18-code/realdata-country.py",
        "codeSHA256": "a2490b59942f74062c89bc7e2218c1c26a3fcb7b4b131f8f16383548123bfc14",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='realdata'\nINPUT={'case': 'country'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='realdata'\nINPUT={'case': 'country'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "case": "country"
        },
        "inputFiles": [
          {
            "file": "metr18-sources/actual90-KOR-growth-CPI-original-1980-2024.csv",
            "sha256": "cc2fb516c33bb55a7bad8849f1103ad4a1c375d9f28853cf1a6dc64f4e0334ad"
          },
          {
            "file": "metr18-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "f03c12fe87497fe884212050309d09da77bd07f1b4975730fed1b53e5bb3b23f"
          },
          {
            "file": "metr18-sources/actual410-NJPA-original-codebook-fields.csv",
            "sha256": "abd533f9a11e44fe20c812cdcf8b69291ea498b3089122950854b7fbd4e77a92"
          }
        ],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "nativeModelRows=43.000000000, completeRows=43.000000000, OLS=0.474120093, twoInstrument2SLS=1.656546472, twoStepGMM=1.683845567, J=0.009466191, scalarZ0Ratio=1.635861612\r\n",
        "stderr": "",
        "summary": {
          "nativeModelRows": "43.000000000",
          "completeRows": "43.000000000",
          "OLS": "0.474120093",
          "twoInstrument2SLS": "1.656546472",
          "twoStepGMM": "1.683845567",
          "J": "0.009466191",
          "scalarZ0Ratio": "1.635861612"
        },
        "plotPoints": [
          {
            "x": "719084664006869/100000000000000",
            "y": "846826958565821/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "342061419498921/100000000000000",
            "y": "16833507183191/1250000000000",
            "series": "Complete native rows"
          },
          {
            "x": "227395640001863/100000000000000",
            "y": "106366054976723/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "122955439607637/50000000000000",
            "y": "158775909552109/20000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "274998096063357/100000000000000",
            "y": "1150298504807/100000000000",
            "series": "Complete native rows"
          },
          {
            "x": "304966077087423/100000000000000",
            "y": "64461044959287/5000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "142921954744321/20000000000000",
            "y": "30332987776793/2500000000000",
            "series": "Complete native rows"
          },
          {
            "x": "2850082722807/500000000000",
            "y": "358250868961921/50000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "214331806432169/25000000000000",
            "y": "100248996213899/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "186655809632299/20000000000000",
            "y": "27187434819427/2500000000000",
            "series": "Complete native rows"
          },
          {
            "x": "38833009147199/6250000000000",
            "y": "635159199606441/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "480099660215353/100000000000000",
            "y": "174867947935639/25000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "626585950039679/100000000000000",
            "y": "93718357757101/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "7001157946207/1562500000000",
            "y": "97358937505409/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "492454354292753/100000000000000",
            "y": "799042982526839/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "44389318457463/10000000000000",
            "y": "62821926537929/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "375679004039653/50000000000000",
            "y": "-49389297463141/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "812957254446369/1000000000000000",
            "y": "116172629559591/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "225916580080157/100000000000000",
            "y": "92018583880479/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "6354024810903/1562500000000",
            "y": "118148390080589/25000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "276226210296599/100000000000000",
            "y": "774399895319569/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "351487451459939/100000000000000",
            "y": "307472661826947/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "359066298882577/100000000000000",
            "y": "25918184298667/5000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "275379162735039/100000000000000",
            "y": "108955916834289/25000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "5605850712973/2500000000000",
            "y": "262250275290171/50000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "63364345534483/25000000000000",
            "y": "58419633918717/10000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "14605926735419/3125000000000",
            "y": "300440451679569/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "275649654493929/100000000000000",
            "y": "16397235128359/20000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "58785730531137/20000000000000",
            "y": "698166138853071/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "40259650043609/10000000000000",
            "y": "4610040075369/1250000000000",
            "series": "Complete native rows"
          },
          {
            "x": "218707104433313/100000000000000",
            "y": "127383275284121/50000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "32533688636853/25000000000000",
            "y": "16456979771721/5000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "127477446401321/100000000000000",
            "y": "80367004920777/25000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "706331772455749/1000000000000000",
            "y": "146014633650617/50000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "971685739912167/1000000000000000",
            "y": "63430549796787/20000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "97216615393183/50000000000000",
            "y": "858297940993/250000000000",
            "series": "Complete native rows"
          },
          {
            "x": "29516787000529/20000000000000",
            "y": "317611568177327/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "76600060721627/200000000000000",
            "y": "9255208423819/4000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "537288023411737/1000000000000000",
            "y": "-350121158771053/500000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "249833333333339/100000000000000",
            "y": "461296795454287/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "508951365062841/100000000000000",
            "y": "272756456708991/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "35974562502901/10000000000000",
            "y": "158301467403629/100000000000000",
            "series": "Complete native rows"
          },
          {
            "x": "116087164321771/50000000000000",
            "y": "100180550919493/50000000000000",
            "series": "Complete native rows"
          }
        ],
        "plotFile": "metr18-fixed-results/realdata-country-python/plot.svg",
        "plotSHA256": "27e95992df2142f3a9c46bd68d10b236c9c4fea40bc9dcff4df62e33401429e8",
        "files": [
          {
            "file": "metr18-fixed-results/realdata-country-python/full.json",
            "sha256": "5a6cb1bc3e75d860d5199a845fee6c3fd5ac454156a0785a7bff2d38cd9e6c77"
          },
          {
            "file": "metr18-fixed-results/realdata-country-python/plot-points.csv",
            "sha256": "b0a706e9dca760732a75010d0f2856dd37ba1ca6c0cd504047a71c3c0463ece9"
          },
          {
            "file": "metr18-fixed-results/realdata-country-python/plot.svg",
            "sha256": "27e95992df2142f3a9c46bd68d10b236c9c4fea40bc9dcff4df62e33401429e8"
          },
          {
            "file": "metr18-fixed-results/realdata-country-python/summary.csv",
            "sha256": "c7d472f4df817d64f77e87c8549e065957afe03768656a806e1cb4c79e2e6a74"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "person": {
        "api": "realdata",
        "variant": "person",
        "language": "python",
        "codeFile": "metr18-code/realdata-person.py",
        "codeSHA256": "c690554048d520ec8e5f1329f2e71d228319d403710310f8a27b8a11e78e58e9",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='realdata'\nINPUT={'case': 'person'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='realdata'\nINPUT={'case': 'person'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "case": "person"
        },
        "inputFiles": [
          {
            "file": "metr18-sources/actual90-KOR-growth-CPI-original-1980-2024.csv",
            "sha256": "cc2fb516c33bb55a7bad8849f1103ad4a1c375d9f28853cf1a6dc64f4e0334ad"
          },
          {
            "file": "metr18-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "f03c12fe87497fe884212050309d09da77bd07f1b4975730fed1b53e5bb3b23f"
          },
          {
            "file": "metr18-sources/actual410-NJPA-original-codebook-fields.csv",
            "sha256": "abd533f9a11e44fe20c812cdcf8b69291ea498b3089122950854b7fbd4e77a92"
          }
        ],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "nativeModelRows=3613.000000000, completeRows=3010.000000000, OLS=0.052094237, twoInstrument2SLS=0.198413333, twoStepGMM=0.199626104, J=3.329200932, scalarZ0Ratio=0.188062635\r\n",
        "stderr": "",
        "summary": {
          "nativeModelRows": "3613.000000000",
          "completeRows": "3010.000000000",
          "OLS": "0.052094237",
          "twoInstrument2SLS": "0.198413333",
          "twoStepGMM": "0.199626104",
          "J": "3.329200932",
          "scalarZ0Ratio": "0.188062635"
        },
        "plotPoints": [
          {
            "x": "7",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "659167373/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "633682573/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "40063593/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62441669/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "107597947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "339785289/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "648920493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "685012617/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "641999493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "32017871/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "22638211/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "374777097/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "644888939/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "33359613/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "612468339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "671417053/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "110825271/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "685012617/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "70440329/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "36129647/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "545958551/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "643615037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "292032083/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "293323403/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "649072353/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "160783277/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "330197191/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "7043487/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "607304453/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "32790989/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "634738921/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "660665019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "638350663/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "536129217/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "735436233/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "665157187/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "158640909/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "322047327/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "317805383/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "666949809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "138393677/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "663068339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "56454469/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "352070583/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "26788137/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "329720673/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "127534539/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "53082677/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "134088287/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "642810527/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "623832463/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "701301579/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "141019789/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "67178047/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "682762923/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "349050287/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "170059869/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "326251483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "345637141/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "131723433/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "34396779/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "615697899/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "582008293/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "594803499/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "32769667/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "614418563/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "682871207/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "333791161/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158640909/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "32790989/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163561799/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "660258789/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "22638211/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "129662147/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "557972983/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "159671983/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "614203741/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "282624459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "672262979/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "663725803/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "667834211/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "150342879/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "339448587/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "317805383/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "320918247/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "624222327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "612468339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "342875703/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "87707621/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "566642669/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "35714137/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "320918247/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "562762111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "90922329/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "345137137/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "67546041/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "653087763/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "168095811/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "322523521/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "653524127/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "326251483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "650727771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "693342303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "141747023/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "141019789/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "157702461/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5590763/781250",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "127534539/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "307316463/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "341705437/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "632076829/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "298178967/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "667834211/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "615485809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "53082677/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "123308357/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "491265489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "359345051/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "631173481/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "678105763/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "663331843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "656244409/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "317805383/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313738101/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "664639051/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "149217689/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "26788137/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "157427733/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "7981493/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "676157277/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "623441073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "82932917/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "620050917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "152451857/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "40063593/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "3",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "670073111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289344869/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "670318811/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "702553831/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "328614127/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319090801/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "76197807/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "619031541/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "130878237/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "632076829/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "650428817/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "77848893/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "663068339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "137873127/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "565599181/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "544241771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "82136037/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "655250789/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "676619171/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "682110747/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "43567063/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "323073409/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "282624459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "298178967/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "691770561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "688243747/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "122754541/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "361744921/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "599396143/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5768321/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "624222327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "33359613/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "141667757/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "82136037/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "3157679/500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "79516281/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "336729583/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "30246567/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "334604187/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "292032083/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "672982407/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "633327963/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "362567249/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "61737861/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "337613519/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "330197191/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "696413561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "634913899/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "167271057/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "660665019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "593753621/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "163561799/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "346082909/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "35176343/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "23261449/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "691770561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "21064123/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "656526497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "335465217/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "610255859/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "695559261/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "177293553/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "16341729/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "64738907/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "771601527/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "90922329/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "89255663/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "661204103/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "21064123/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670073111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "632972091/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "282624459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "15199833/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "63630281/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "127534539/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "574300319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "116754609/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "631896811/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "327482537/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "30246567/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "355166103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "330669211/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "306343459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "647234629/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "330669211/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670318811/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "324384201/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "674641213/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "649677499/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "169752431/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "544241771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "668710861/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "313926071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "665286303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "123308357/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "346082909/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "632076829/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "156727407/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "141019789/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "675110147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "30858503/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "689669433/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "610255859/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "21592979/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "712367279/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "170636501/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "634738921/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "141019789/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "61737861/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "673221071/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "724565507/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "656526497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "298050267/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163344721/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "322285991/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "695081477/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "133211503/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "649072353/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "691770561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "121088787/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "696602419/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "602586597/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "9685123/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "567332327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "329720673/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "619031541/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "582008293/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "131723433/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "341489687/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "624222327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "43567063/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161458457/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5160389/781250",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "620050917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "322206563/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "150342879/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "330669211/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157702461/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "289344869/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "277647979/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "129198089/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "622257627/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "691770561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "166642093/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "315130949/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "134380263/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "25344521/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "57170277/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "311622401/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "90922329/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "67787849/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "676041469/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "660665019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "169752431/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "306343459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "661204103/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "169752431/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "32017871/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "8268407/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "316396839/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "302486673/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "12941599/2000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "25574363/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "156727407/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "134904727/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "622653667/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "623832463/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "25184763/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158064131/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "118377877/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "318495049/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "62441669/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "298307337/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7043487/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "16341729/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "291740537/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "587493073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "11136689/2000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "660665019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "291740537/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "562040087/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "109529271/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7994077/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "499043259/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7043487/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "691770561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "624804287/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "639024067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "58230459/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "286015589/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "593224519/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "656244409/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "601859321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "143993567/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "657368017/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "525749537/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "167021367/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "682871207/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "693244789/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622059017/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "123308357/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "649677499/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "656103067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "683303173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "80865629/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "693342303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "146764763/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "682762923/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "317106071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "350875307/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "656807791/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "341489687/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "280105941/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "168125841/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "177251921/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "159118769/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "653087763/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "628599809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "16341729/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651767127/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "615909539/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "160742987/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "29674471/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "17165817/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "76113061/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "163344721/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "62166061/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "344428623/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "656103067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "347492823/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "82932917/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "162381639/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "157427733/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "323073409/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "284686607/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "685329909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "160742987/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "562401751/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "82361581/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "614203741/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "656526497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "168125841/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "90922329/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "720489251/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "156249381/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "612249281/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "150342879/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "632614947/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "693342303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "349328323/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "177293553/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "23184231/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "742833319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5590763/781250",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "76197807/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "307316463/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "650428817/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "565599181/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "665286303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "139225921/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "162904827/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "326906991/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "90922329/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "38765847/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "2568389/390625",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "80826809/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "652062113/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "19626237/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "591350301/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "648920493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "573979291/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "336729583/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "40576499/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "32790989/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "28383769/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "90922329/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "177293553/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "147592643/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "167271057/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "598645201/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "675110147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "292177221/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "632972091/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "40799737/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "615060277/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "82361581/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "26506871/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "323073409/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "726192709/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "82932917/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "701301579/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "663725803/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "352592781/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "631896811/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "157427733/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "676157277/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "320918247/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "156297597/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "656103067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "335343117/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "32769667/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "359345051/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "77632501/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "649677499/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "347059503/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "698378997/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "160742987/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "696413561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "666695679/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "618414889/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "329101257/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "130878237/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "157702461/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "333791161/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "30246567/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "333791161/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "170059869/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "129662147/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "119012851/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "714203657/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "661606519/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "325512917/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "43066307/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "177293553/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "67310181/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "76197807/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "167021367/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "293886789/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "476217393/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "78551677/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "627664349/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "473369/78125",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "349879799/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "1210029/160000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "134904727/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "154030183/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "648616079/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "352375861/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "581114099/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "32769667/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "338654019/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "323073409/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "350198707/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "682871207/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "65482191/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "632076829/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "127432237/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "133211503/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "648616079/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5590763/781250",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "647234629/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "136874999/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "628599809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "141747023/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "525749537/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "335343117/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "670073111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "82361581/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "702553831/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "74986707/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "32790989/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "582008293/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "168125841/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "525749537/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "659304453/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "33564781/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "13199741/2000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "291447281/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "610255859/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "107597947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "293181559/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138314469/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "129662147/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "668835471/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158640909/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "80865629/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "152451857/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "319006127/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "631716469/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "328474071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "660665019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651767127/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "167021367/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "156297597/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "597380961/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "68145429/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "2374079/390625",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "626530121/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "1084107/200000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "656667243/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "26672913/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "306014871/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "562401751/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "643615037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "654678541/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "29674471/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "615909539/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "619644413/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "682871207/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "151536423/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "591350301/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "622653667/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "642810527/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "297139969/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "127534539/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "618208491/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "168185793/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "619644413/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "681783057/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "672262979/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "607304453/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "544241771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "9342009/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "707918439/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62166061/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "145427779/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "633682573/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "687109129/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "722548147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "641181827/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "650727771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "152451857/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "618414889/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "656526497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "68596149/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "61737861/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "612468339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "65971457/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "115981853/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150403929/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "309310431/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "588332239/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "115981853/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "19389243/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "648157713/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329101257/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163919459/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "624222327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "643294009/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "648157713/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "80826809/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "129965643/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "631896811/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "64645883/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "359269351/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622257627/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "133211503/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "40799737/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "644254017/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "631716469/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "32017871/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "640687999/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "346426891/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "636818719/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163990381/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "648616079/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "40799737/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "562040087/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "656103067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "666949809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "143692583/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329101257/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "663331843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "607304453/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "141667757/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "591350301/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "607534603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "580513497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323073409/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "329101257/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "129965643/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "339952793/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "333791161/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "628971557/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "339952793/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "341489687/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "124609629/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "341705437/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "32790989/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "558349631/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "171146997/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664118217/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "656103067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "40799737/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "326251483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "682219739/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "330197191/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "706219163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "663987583/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "648920493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "639024067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "681234509/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "695559261/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "306014871/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "341489687/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "633327963/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "361491939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "666949809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "298178967/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "587211779/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "670318811/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "607534603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "532787617/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "618414889/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "331600089/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "345137137/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "706219163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "574939299/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "681892407/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "129965643/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "66631327/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "279362433/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "587211779/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "633327963/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "666695679/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "177293553/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150403929/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "591350301/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "83384579/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "713169851/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "242601513/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "598141421/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "322285991/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "618414889/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157702461/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "118377877/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "329720673/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "80290587/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "615485809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "606378521/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "279362433/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "606842559/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313738101/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "127534539/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "336729583/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "170636501/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "321324423/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "573979291/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "17165817/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4410743/800000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "326906991/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "610702289/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "713089883/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "619440539/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "637331979/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "289344869/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "606378521/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "634738921/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "641181827/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "328474071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "656526497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "603548143/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "80168237/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "16606217/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "160742987/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "624610677/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "64645883/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "317106071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "688550967/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "133160221/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "609356977/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "133005581/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "170059869/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "618414889/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "339785289/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "139225921/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "17096013/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "317106071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "172366751/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "64738907/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "610702289/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "63630281/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "253758691/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "676388491/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "326324743/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "87707621/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "565599181/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "694601399/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "581413053/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "156249381/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "656385553/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "160863663/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "569709349/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "612905021/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "598141421/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "159671983/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "694601399/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "65482191/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "328474071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "696413561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "319006127/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "322523521/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "666949809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "168095811/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "628971557/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "329101257/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "305684109/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "597380961/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "689669433/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "677992191/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "340396747/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "587493073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "562762111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "28047359/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "16004793/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "350153273/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "582008293/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "26517453/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "631716469/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "606842559/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "167021367/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "669332367/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "17096013/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "160863663/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "579301361/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "682762923/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "314578457/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "612905021/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "618414889/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "622257627/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "589440283/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "129662147/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "67787849/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "653233429/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "599645209/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "473369/78125",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "131723433/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "41620587/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "55759491/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "688755257/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "292032083/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "633327963/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "122754541/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "633682573/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161458457/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "650727771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "296078921/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "79054487/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "79054487/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "115981853/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "168894223/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "547227067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "293886789/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617794411/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "343085567/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "141747023/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "2625086/390625",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "25574363/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "160742987/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "61484683/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "663331843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "316396839/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "518738581/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "71685799/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "123308357/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "665286303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "151536423/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "607534603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "302486673/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "619236249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "291447281/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "159118769/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62441669/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "695939851/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "731455283/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "290105919/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "149598407/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "21064123/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "331600089/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "43358213/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "677536609/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "317106071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "313926071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "32017871/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "324384201/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7043487/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "335343117/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "643615037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "32017871/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "651323011/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "67787849/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "667456139/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "578996017/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "666695679/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "582008293/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "151536423/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "68916259/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "330669211/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "292177221/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "631716469/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "557215403/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "330669211/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "630078579/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "643615037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670073111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "618414889/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "336729583/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "616751649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "62441669/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "34657359/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "657646957/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "667959919/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150946773/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "606610809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "163235471/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "631173481/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "656103067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "312979073/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "149598407/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "338539471/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "29674471/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "589715387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "314578457/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "588610403/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "2",
            "y": "292177221/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "695844839/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "177293553/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "563835467/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "484418709/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "723921497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "604025471/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "306014871/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "81171923/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "305684109/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "62126061/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "614203741/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "295404147/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "612468339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "566642669/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "108232921/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "589440283/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "2716861/500000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "34095757/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "614203741/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "191039111/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651914729/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "32769667/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "587211779/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "588332239/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "73188399/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "568017261/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "609356977/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "139960549/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "639024067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313738101/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319090801/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622059017/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "722548147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "32769667/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "76197807/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "316396839/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "714598447/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "636818719/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "471849887/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "30246567/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "141019789/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "186655689/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "659304453/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "165030753/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "56454469/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150706963/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "625766759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163990381/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "150342879/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "301534263/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "666695679/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "616961073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "282974111/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "110825271/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "39134323/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "28383769/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "681234509/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "293323403/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "352592781/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "133211503/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "301534263/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "589715387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "588053299/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "156727407/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570044357/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "314578457/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "156727407/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "528826703/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662406523/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "152451857/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "3",
            "y": "511799381/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "152451857/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "598645201/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "312979073/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "139960549/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "57365723/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "170059869/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "282624459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "562762111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "74640773/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "623636959/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "643615037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "549716823/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "589440283/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "640687999/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "663331843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "19389243/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "134380263/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "279362433/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "285355513/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "648920493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "624222327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "286015589/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "606378521/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "460517019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "130911049/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "587211779/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "279362433/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "279362433/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "637331979/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "630078579/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "126630037/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "339561073/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "301534263/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "326324743/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "57365723/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "129965643/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "565599181/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "165233731/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "160863663/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "16004793/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "115981853/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "40799737/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "699484999/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "123308357/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "342823099/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "704053639/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "610479323/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "80290587/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "619440539/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150706963/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "352592781/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "79054487/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "293039311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329170461/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "634388043/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "58230459/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "35393503/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "10535751/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "338654019/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "8885899/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "566642669/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "569709349/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "350016723/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "614203741/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "557972983/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "673221071/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "545958551/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "263905733/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "581114099/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "15295243/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "685118493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "567332327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "154030183/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "113807189/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "604025471/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "156297597/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "575574221/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "685012617/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "597380961/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "9685123/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "279549349/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "563835467/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "557215403/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "138393677/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "168125841/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "57651911/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "603548143/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "125344011/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "156297597/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "581413053/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "675110147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "575574221/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "672262979/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "722548147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "305573367/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "40799737/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "607534603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "675110147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "34657359/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "76113061/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "600388707/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150403929/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "138393677/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "305684109/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "298050267/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "9685123/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "162115881/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "656385553/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "623636959/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "602586597/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "615485809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "619440539/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "330669211/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "640687999/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "633327963/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "671052311/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "26788137/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "29621279/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "642810527/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "127432237/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "318751241/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313926071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "162115881/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "321243451/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128005149/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "653087763/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "31440237/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "638856141/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "57170277/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "564190707/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "656667243/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "686589107/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "76197807/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "545958551/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "552942909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "298307337/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "35393503/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "588610403/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "597380961/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "130911049/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "282624459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "664639051/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "79054487/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "373738609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "130878237/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "619236249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "311622401/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "335343117/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6228511/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "640687999/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "670073111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "282624459/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "348677151/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "23123119/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "675693239/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "331402069/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "350425259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "567332327/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "580513497/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "625382881/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "501063529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "339785289/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "36110327/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "548479693/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "663068339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "151806939/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "130878237/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "619644413/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "633682573/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "291447281/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "569709349/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "350016723/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "640687999/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "318921309/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "298307337/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "609356977/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "656103067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "166418163/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "623441073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "152282747/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "357535073/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "600388707/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "7043487/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "380120067/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "676388491/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "677992191/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "80168237/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "499721227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "671417053/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "62441669/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "656807791/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "673933663/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "135711753/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "674641213/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "330197191/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "667834211/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "79516281/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "676734313/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "361672771/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "147592643/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "649677499/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "673933663/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "324384201/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "177251921/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "664639051/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "116754609/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "765681009/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "346817137/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "638856141/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "168125841/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "511799381/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "307316463/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "80826809/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "650128967/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "166642093/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "130055801/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "654678541/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "163235471/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "602586597/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "132428113/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "544241771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "717701877/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "696413561/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "322047327/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "43478409/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "43066307/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5590763/781250",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "335343117/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "657925121/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "136874999/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "133211503/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "345187363/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "127329409/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "544241771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "628971557/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "644254017/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651323011/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "544241771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "657368017/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "565599181/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "574300319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "350425259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "636818719/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "321324423/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "562401751/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "163489649/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "633327963/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "143948707/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "337613519/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "643935037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "181861989/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "145427779/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "61737861/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "30858503/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "347252553/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "349696649/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "292466239/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "13516189/2000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "564190707/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327482537/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "19626237/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "84212087/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "3157679/500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "346082909/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "664768837/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "68145429/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "330669211/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651323011/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "664639051/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "82361581/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "650128967/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "163344721/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "316396839/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "650727771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "658755001/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "141019789/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "604500531/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "348442519/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "706902343/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "674758653/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "80168237/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "177251921/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "346817137/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157427733/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "675110147/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "131806021/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "693244789/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "141019789/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "43066307/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "82361581/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "627664349/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "566642669/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "350153273/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "40576499/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "557215403/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "110825271/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "650727771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "695559261/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "376038821/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "163344721/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "30858503/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "72898531/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "680903931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "293039311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "665286303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "638350663/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "660665019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "313926071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "723993259/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "324384201/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "634913899/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "643615037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "152282747/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "314578457/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "336729583/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "658479139/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "158064131/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "581114099/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "623441073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "623636959/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "573979291/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "650727771/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "322365293/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "650128967/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "647234629/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "292177221/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "673340189/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "170582153/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "659304453/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "610479323/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "123600333/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "601859321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "135711753/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "65971457/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "612905021/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "327482537/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "166642093/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "341489687/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "610702289/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "326324743/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "625766759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "78667741/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "674758653/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7880561/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "348677151/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5160389/781250",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "72984451/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "170059869/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "314578457/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "133440659/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "63403593/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "587493073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "313738101/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "49698133/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "309310431/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "25574363/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "334975017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "347492823/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "668461173/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "334975017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "132428113/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "568357977/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605678401/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "35306089/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "61737861/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "29674471/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "124609629/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329170461/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "177293553/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "633327963/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "82223267/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "349328323/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "132428113/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "587493073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "599396143/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "282974111/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "35833383/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "635957387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "515329159/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617794411/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "168125841/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "281560589/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "248836687/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "670563909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "601126717/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "626530121/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "635957387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "160742987/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "63630281/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "352592781/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "80290587/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "36110327/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "347252553/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "619644413/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "298050267/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "660258789/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7994077/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "175771437/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "639859493/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "569709349/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "545958551/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "654678541/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "141747023/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "275469417/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "648616079/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "656667243/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "639024067/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "635957387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "651914729/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "146764763/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "675693239/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "19626237/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "286504989/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "314578457/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "292032083/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5768321/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "29674471/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "130911049/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "256198199/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "2",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "3",
            "y": "524702407/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "86346941/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "25340217/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "643615037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "587211779/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "137015973/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "603548143/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "693342303/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "8885899/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "9824779/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "656667243/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "2716861/500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "57365723/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5768321/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "571373281/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "662406523/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "21064123/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "30858503/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "151536423/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "619440539/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "573979291/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "280105941/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "297139969/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "614203741/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "306014871/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "32790989/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "35393503/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "151536423/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "313738101/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608677473/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "612468339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "302368609/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "604025471/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "82136037/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "598645201/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "598645201/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "659850903/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163344721/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "535658627/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "306014871/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "327482537/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "589715387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "160783277/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "72898531/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "619236249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "117997947/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "69363451/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "35393503/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "676388491/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "630627529/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "607073773/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7880561/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "587211779/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "10535751/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "566642669/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "612468339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "656667243/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "80942909/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "322523521/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "638350663/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "663856779/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "588332239/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "74986707/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "122754541/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "598141421/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "562762111/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "150706963/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "90922329/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "4",
            "y": "241415687/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "156393751/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "558349631/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "291447281/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "268298801/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163344721/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "612468339/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "642162227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "659578051/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "25468751/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "9685123/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "158859251/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "623441073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "633682573/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "62441669/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "615485809/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "581413053/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "64645883/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "158772143/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "588610403/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "582600011/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "63630281/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "36071507/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "152451857/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "552942909/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150946773/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "575890177/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "659167373/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "574939299/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "107872551/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "545958551/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4752137/800000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "298307337/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "651174533/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "123600333/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "4",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "614203741/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "156727407/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "152451857/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "557972983/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "288102569/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "643935037/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "29674471/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "668835471/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "610255859/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "57651911/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "599396143/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "301654311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "80290587/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "586929691/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "557972983/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "121088787/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "316396839/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "566642669/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "597380961/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "292321939/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5590763/781250",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "676272951/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "329031957/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "31521407/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150158829/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "21064123/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "660800063/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "82361581/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "687729607/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "132428113/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "37508843/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "80290587/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "247791353/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "604500531/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "161924309/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "325512917/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "586929691/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "613122649/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "606842559/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "290105919/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "127432237/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5768321/1000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "330197191/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "323151473/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150158829/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "1292621/250000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "28383769/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "133717219/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "25129067/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "604500531/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "79054487/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "309310431/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "589440283/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "247791353/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "610479323/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "163990381/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "19626237/3125000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "651471269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "556068163/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "44390621/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "597635091/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "56167711/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "587493073/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "135711753/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "525749537/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "604025471/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "589715387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "293323403/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "301534263/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "319846483/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "86004801/12500000",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "573979291/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "561312811/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "607534603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "329720673/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "139960549/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "1292621/250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "473369/78125",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "660665019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "327554017/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "28047359/5000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "644888939/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "566642669/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "543807931/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "9342009/1562500",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "634913899/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "157747957/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "589440283/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "460517019/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "141747023/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "4",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "168125841/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "607534603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "580814249/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "57235851/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "158772143/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "35393503/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "122754541/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "298178967/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "350425259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "550125821/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "588053299/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "293886789/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "119829291/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "3157679/500000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "150342879/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "582008293/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7043487/1250000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "312979073/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "326906991/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "605208917/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "147221949/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "3147633/500000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "664509097/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "622455843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "319090801/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "150946773/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "36942479/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "608221891/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "642810527/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "677422389/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "51629/8000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "574620319/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "117158663/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "42208987/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "594803499/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "550125821/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "334728103/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "622653667/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "137380289/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "165267401/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "123308357/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "120304609/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "333854173/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "613556489/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "13540251/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "635784227/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "103859137/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "289191259/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "150342879/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "628971557/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "586929691/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "138036523/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "654103/100000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "604025471/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "590263333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "293039311/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "170418397/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "170059869/25000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "22907391/4000000",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "15408287/2500000",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "291447281/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "122754541/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "529831737/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "35953579/6250000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "128755033/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "553733427/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "592692603/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "589715387/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "662007321/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "318921309/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "557972983/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "570378247/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "298307337/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "305462379/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "557215403/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "606842559/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "525749537/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "2625086/390625",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "124805517/20000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "627098843/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "595324333/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "656807791/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "615697899/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "615273269/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "602344759/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "581413053/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "617586727/100000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "62146081/10000000",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "328474071/50000000",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "313169913/50000000",
            "series": "Complete native rows"
          }
        ],
        "plotFile": "metr18-fixed-results/realdata-person-python/plot.svg",
        "plotSHA256": "633b0563bdb50230f6cd76dfb7e042a79c058d8958c2ff59e70d0316838558cf",
        "files": [
          {
            "file": "metr18-fixed-results/realdata-person-python/full.json",
            "sha256": "efeef2313f3b63ac6dd808ea7f18d864bfbbe1629b9b2494f3bf65fa4bcbef21"
          },
          {
            "file": "metr18-fixed-results/realdata-person-python/plot-points.csv",
            "sha256": "87db32cf48fb7186fc75eb985f3a3531a5c69e19cd1fec19e0a4d76a70bb93e4"
          },
          {
            "file": "metr18-fixed-results/realdata-person-python/plot.svg",
            "sha256": "633b0563bdb50230f6cd76dfb7e042a79c058d8958c2ff59e70d0316838558cf"
          },
          {
            "file": "metr18-fixed-results/realdata-person-python/summary.csv",
            "sha256": "e741309a89f79cdb3f666a8861906a8bb645ecb28c0ba9435e66270cbac922ae"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "company": {
        "api": "realdata",
        "variant": "company",
        "language": "python",
        "codeFile": "metr18-code/realdata-company.py",
        "codeSHA256": "7bd13f18ee9fb923a3394d66a745f6666aa07eead9fe1fe405d26c68880c3890",
        "codeText": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='realdata'\nINPUT={'case': 'company'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "code": "#!/usr/bin/env python3\n\"\"\"METR18: exact finite IV/first-stage/GMM algebra from three native-token CSVs.\nPython3 standard library only. One endogenous regressor, two proposed instruments,\ncentered intercept, common complete frame and unit row mass. These computations\ndo not certify exclusion, strong identification, independence or causal effects.\nThe scalar AR/Fieller calculation uses only instrument0 and a stipulated threshold4;\nit is not automatically a 95% confidence interval for the two-instrument estimate.\n\"\"\"\nfrom pathlib import Path\nfrom fractions import Fraction as F\nimport csv,json,argparse,math\n\ndef dot(a,b):return sum((x*y for x,y in zip(a,b)),F())\ndef inverse(a):\n    n=len(a);z=[list(r)+[F(i==j)for j in range(n)]for i,r in enumerate(a)]\n    for j in range(n):\n        p=next((i for i in range(j,n)if z[i][j]),None)\n        if p is None:raise ValueError('singular matrix')\n        z[j],z[p]=z[p],z[j];v=z[j][j];z[j]=[x/v for x in z[j]]\n        for i in range(n):\n            if i!=j:\n                c=z[i][j];z[i]=[x-c*y for x,y in zip(z[i],z[j])]\n    return[r[n:]for r in z]\ndef mv(a,x):return[dot(r,x)for r in a]\ndef mm(a,b):return[[dot(r,c)for c in zip(*b)]for r in a]\ndef outer_sum(z,u):return[[sum((r[j]*r[k]*v*v for r,v in zip(z,u)),F())for k in range(len(z[0]))]for j in range(len(z[0]))]\ndef q(s):return None if s in['','.']else F(s)\ndef token(x):\n    if x is None:return''\n    if isinstance(x,bool):return str(x)\n    if isinstance(x,F):return str(x)\n    return str(x)\ndef pack(v):\n    if isinstance(v,F):return str(v)\n    if isinstance(v,list):return[pack(x)for x in v]\n    if isinstance(v,dict):return{k:pack(x)for k,x in v.items()}\n    return v\ndef sources(directory):\n    def rd(n):\n        with(directory/n).open(encoding='utf-8-sig',newline='')as f:return list(csv.DictReader(f))\n    wb=rd('actual90-KOR-growth-CPI-original-1980-2024.csv');look={(int(r['year']),r['indicatorID']):r for r in wb};country=[];lineage=[]\n    growth='NY.GDP.MKTP.KD.ZG';inflation='FP.CPI.TOTL.ZG'\n    for year in range(1980,2025):\n        Y=look[year,growth];X=look[year,inflation];lags=[look.get((year-j,growth))for j in[1,2]]\n        lineage.append(dict(year=year,y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z0=None if lags[0]is None else q(lags[0]['valueExactToken']),z1=None if lags[1]is None else q(lags[1]['valueExactToken']),ySource=Y['originalSourceRow'],xSource=X['originalSourceRow'],z0Source=''if lags[0]is None else lags[0]['originalSourceRow'],z1Source=''if lags[1]is None else lags[1]['originalSourceRow'],inDeclaredModel=year>=1982,reason='prior-two-year-lags-required'if year<1982 else''))\n        if year>=1982:country.append(dict(id='KOR:'+str(year),sourceRow=year,nativeID='KOR',y=q(Y['valueExactToken']),x=q(X['valueExactToken']),z=[None if r is None else q(r['valueExactToken'])for r in lags]))\n    people=[]\n    for i,r in enumerate(rd('actual3613-NLS-original52-fields.csv'),1):people.append(dict(id='nls-row:'+str(i),sourceRow=i,nativeID=r['id'],y=q(r['lwage76']),x=q(r['ed76']),z=[q(r['nearc4']),q(r['nearc2'])]))\n    company=[]\n    for i,r in enumerate(rd('actual410-NJPA-original-codebook-fields.csv'),1):\n        def fte(suffix):\n            a=[q(r[k+suffix])for k in['EMPFT','NMGRS','EMPPT']]\n            return None if None in a else a[0]+a[1]+a[2]/2\n        before,after=fte(''),fte('2');w1,w2=q(r['WAGE_ST']),q(r['WAGE_ST2'])\n        company.append(dict(id='njpa-row:'+str(i),sourceRow=i,nativeID=r['SHEET'],y=None if before is None or after is None else after-before,x=None if w1 is None or w2 is None else w2-w1,z=[q(r['STATE']),q(r['CO_OWNED'])]))\n    return dict(country=country,person=people,company=company),lineage\ndef ar(delta,pi,s,b,critical=F(4)):\n    moment=delta-b*pi;variance=s[0][0]-2*b*s[0][1]+b*b*s[1][1]\n    if variance<0:raise ValueError('negative variance')\n    statistic=moment*moment/variance if variance else None\n    status='finite'if variance else'positive-infinity'if moment else'undefined-zero-over-zero'\n    accepted=statistic<=critical if variance else False if moment else None\n    return dict(moment=moment,variance=variance,statistic=statistic,status=status,accepted=accepted)\ndef fieller(delta,pi,s,c=F(4)):\n    if s[0][0]<=0 or s[0][0]*s[1][1]-s[0][1]**2<=0:raise ValueError('Fieller requires positive definite covariance')\n    A=pi*pi-c*s[1][1];B=-2*delta*pi+2*c*s[0][1];C=delta*delta-c*s[0][0];disc=B*B-4*A*C\n    center=radicand=lo=hi=None\n    if A:\n        if disc<0:shape='all-real'if A<0 else'empty'\n        elif disc==0:\n            center=-B/(2*A);shape='all-real'if A<0 else'singleton';lo=hi=float(center)\n        else:\n            center=-B/(2*A);radicand=disc/(4*A*A);radius=math.sqrt(float(radicand));lo=float(center)-radius;hi=float(center)+radius;shape='two-rays'if A<0 else'bounded-interval'\n    elif B:\n        center=-C/B;shape='left-half-line'if B>0 else'right-half-line'\n        if B>0:hi=float(center)\n        else:lo=float(center)\n    else:shape='all-real'if C<=0 else'empty'\n    return dict(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=radicand,lowerApprox=lo,upperApprox=hi,endpointApproximation='uncertified display only; exact polynomial determines membership',threshold=c,covarianceConvention='estimated independent-row HC0, no degrees correction',probabilityCoverage='not automatically95%; threshold4is stipulated')\ndef study(rows):\n    good=[r for r in rows if None not in[r['y'],r['x'],*r['z']]];n=len(good);p=2\n    if n<=p+1:raise ValueError('insufficient common complete frame')\n    ybar=sum((r['y']for r in good),F())/n;xbar=sum((r['x']for r in good),F())/n;zbar=[sum((r['z'][j]for r in good),F())/n for j in range(p)]\n    y=[r['y']-ybar for r in good];x=[r['x']-xbar for r in good];z=[[r['z'][j]-zbar[j]for j in range(p)]for r in good];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];Gi=inverse(G);ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];thetaX=mv(Gi,ZX);thetaY=mv(Gi,ZY);xhat=[dot(r,thetaX)for r in z];yhat=[dot(r,thetaY)for r in z];Sxx=dot(x,x);Sxy=dot(x,y);projected=dot(ZX,thetaX)\n    if not Sxx or not projected:raise ValueError('zero identifying variation')\n    ols=Sxy/Sxx;iv=dot(ZX,thetaY)/projected;u1=[a-iv*b for a,b in zip(y,x)];v=[a-b for a,b in zip(x,xhat)];SSR=dot(xhat,xhat);SSE=dot(v,v);U=outer_sum(z,u1);Ui=inverse(U);den=dot(ZX,mv(Ui,ZX))\n    if not den:raise ValueError('zero weighted identifying denominator')\n    beta2=dot(ZX,mv(Ui,ZY))/den;u2=[a-beta2*b for a,b in zip(y,x)];moments=[dot([r[j]for r in z],u2)for j in range(p)];J=dot(moments,mv(Ui,moments));HC0=mm(mm(Gi,outer_sum(z,v)),Gi);wald=dot(thetaX,mv(inverse(HC0),thetaX));Fclassic=(SSR/p)/(SSE/(n-p-1))if SSE else None\n    zz=[r[0]for r in z];szz=dot(zz,zz);delta=dot(zz,y)/szz;pi=dot(zz,x)/szz;uy=[a-delta*b for a,b in zip(y,zz)];ux=[a-pi*b for a,b in zip(x,zz)];Sigma=[[sum((zi*zi*a*b for zi,a,b in zip(zz,e1,e2)),F())/(szz*szz)for e2 in[uy,ux]]for e1 in[uy,ux]];fs=fieller(delta,pi,Sigma)\n    return dict(n=n,q=p,means=dict(y=ybar,x=xbar,z=zbar),centered=dict(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=Fclassic,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=ybar-iv*xbar,U=U,Ui=Ui,S=[[v/n for v in row]for row in U],W=[[v*n for v in row]for row in Ui],GMM=beta2,GMMIntercept=ybar-beta2*xbar,J=J,degreesOfFreedom=p-1,JReference='chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight',scalar=dict(delta=delta,pi=pi,ratio=delta/pi if pi else None,Sigma=Sigma,fieller=fs),predictions=[dict(id=r['id'],y=r['y'],x=r['x'],z0=r['z'][0],z1=r['z'][1],yCentered=yi,xCentered=xi,z0Centered=zi[0],z1Centered=zi[1],firststageFit=xbar+xf,firststageResidual=vi,reducedFormYFit=ybar+yf,OLSFit=ybar+ols*xi,IVFit=ybar+iv*xi,IVResidual=e1,GMMFit=ybar+beta2*xi,GMMResidual=e2,scalarYResidual=sy,scalarXResidual=sx)for r,yi,xi,zi,xf,yf,vi,e1,e2,sy,sx in zip(good,y,x,z,xhat,yhat,v,u1,u2,uy,ux)])\n\nAPI='realdata'\nINPUT={'case': 'company'}\n# This tail is appended to a byte-preserved copy of the public exact primitives\n# and actual source reader. It never imports or calls the web JavaScript engine.\ndef matrix_rank(a):\n    z=[row[:]for row in a];rank=0\n    for j in range(len(z[0])):\n        p=next((i for i in range(rank,len(z))if z[i][j]),None)\n        if p is None:continue\n        z[rank],z[p]=z[p],z[rank];v=z[rank][j];z[rank]=[x/v for x in z[rank]]\n        for i in range(len(z)):\n            if i!=rank:\n                v=z[i][j];z[i]=[x-v*y for x,y in zip(z[i],z[rank])]\n        rank+=1\n        if rank==len(z):break\n    return rank\ndef fixed_firststage(a):\n    rows=[dict(id=r['id'],y=F(r['y']),x=F(r['x']),z=[F(v)for v in r['z']])for r in a['rows']];n=len(rows);p=len(rows[0]['z']);my=sum((r['y']for r in rows),F())/n;mx=sum((r['x']for r in rows),F())/n;mz=[sum((r['z'][j]for r in rows),F())/n for j in range(p)];y=[r['y']-my for r in rows];x=[r['x']-mx for r in rows];z=[[r['z'][j]-mz[j]for j in range(p)]for r in rows];G=[[sum((r[j]*r[k]for r in z),F())for k in range(p)]for j in range(p)];ZX=[dot([r[j]for r in z],x)for j in range(p)];ZY=[dot([r[j]for r in z],y)for j in range(p)];rank=matrix_rank(G)\n    result=dict(rows=rows,n=n,q=p,means=dict(y=my,x=mx,z=mz),centered=dict(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=None if rank==p else'singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span')\n    if rank!=p:return result\n    Gi=inverse(G);sx=mv(Gi,ZX);sy=mv(Gi,ZY);xf=[dot(r,sx)for r in z];v=[a-b for a,b in zip(x,xf)];SSR=dot(xf,xf);SSE=dot(v,v);Sxx=dot(x,x);ident=dot(ZX,sx);HC0=mm(mm(Gi,outer_sum(z,v)),Gi)\n    try:wald=dot(sx,mv(inverse(HC0),sx))\n    except ValueError:wald=None\n    result.update(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=[mx+a for a in xf],firststageResidual=v,SSR=SSR,SSE=SSE,R2=SSR/Sxx if Sxx else None,classicalF=(SSR/p)/(SSE/(n-p-1))if SSE and n>p+1 else None,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=dot(ZX,sy)/ident if ident else None,identifyingDenominator=ident)\n    return result\ndef fixed_overid(a):\n    f=fixed_firststage(a)\n    if not f['defined']or not f.get('identifyingDenominator'):return dict(firststage=f,defined=False,reason='declared-frame-identification-unavailable')\n    z=f['centered']['z'];x=f['centered']['x'];y=f['centered']['y'];beta1=f['twoSLS'];u1=[a-beta1*b for a,b in zip(y,x)];U=outer_sum(z,u1)\n    try:Ui=inverse(U)\n    except ValueError:return dict(firststage=f,defined=False,reason='singular preliminary moment covariance')\n    beta2=dot(f['ZX'],mv(Ui,f['ZY']))/dot(f['ZX'],mv(Ui,f['ZX']));s=[dot([r[j]for r in z],[a-beta2*b for a,b in zip(y,x)])for j in range(f['q'])];J=dot(s,mv(Ui,s));return dict(firststage=f,defined=True,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=[[v/f['n']for v in row]for row in U],W=[[v*f['n']for v in row]for row in Ui],sumMoments=s,J=J,referenceDF=f['q']-1,testApplicable=f['q']>1,scope='J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction')\ndef native_svg(path,points,xlabel,ylabel,title,zero_line=False):\n    import html\n    good=[(float(x),float(y),s)for x,y,s in points if x is not None and y is not None];xs=[x for x,y,s in good];ys=[y for x,y,s in good]+([0]if zero_line else[]);lo,hi=min(xs),max(xs);bottom,top=min(ys),max(ys);dx=hi-lo or 1;dy=top-bottom or 1;lo-=dx*.04;hi+=dx*.04\n    if bottom>=0 and ('AR' in ylabel or 'J('in ylabel or 'ratio'in ylabel):bottom=0\n    else:bottom-=dy*.06\n    top+=dy*.06;X=lambda x:100+(float(x)-lo)/(hi-lo)*620;Y=lambda y:336-(float(y)-bottom)/(top-bottom)*266;esc=lambda v:html.escape(str(v),quote=True);series=list(dict.fromkeys(s for x,y,s in good));colors=['#245b85','#ad551f','#39754f'];nodes=['<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>'+esc(title)+'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">'+esc(title)+'</text>']\n    for i in range(4):\n        xx=lo+(hi-lo)*i/3;yy=bottom+(top-bottom)*i/3;nodes+=['<path d=\"M'+str(X(xx))+' 70V336\" stroke=\"#e5e9ed\"/><text x=\"'+str(X(xx))+'\" y=\"358\" text-anchor=\"'+('start'if i==0 else'end'if i==3 else'middle')+'\">'+esc(format(xx,'.4g'))+'</text>','<path d=\"M100 '+str(Y(yy))+'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"'+str(Y(yy)+4)+'\" text-anchor=\"end\">'+esc(format(yy,'.4g'))+'</text>']\n    nodes.append('<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>')\n    if zero_line:nodes.append('<path d=\"M100 '+str(Y(0))+'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>')\n    for x,y,s in good:nodes.append('<circle cx=\"'+format(X(x),'.7f')+'\" cy=\"'+format(Y(y),'.7f')+'\" r=\"'+('1.8'if len(good)>200 else'3')+'\" fill=\"'+colors[series.index(s)%3]+'\" fill-opacity=\"0.65\"><title>'+esc(s+' | x='+str(x)+' | y='+str(y))+'</title></circle>')\n    nodes+=['<text x=\"410\" y=\"392\" text-anchor=\"middle\">'+esc(xlabel)+'</text>','<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">'+esc(ylabel)+'</text>']\n    for i,s in enumerate(series):nodes.append('<circle cx=\"'+str(110+230*i)+'\" cy=\"425\" r=\"4\" fill=\"'+colors[i%3]+'\"/><text x=\"'+str(120+230*i)+'\" y=\"429\">'+esc(s)+'</text>')\n    nodes.append('</g></svg>');path.write_text('\\n'.join(nodes)+'\\n',encoding='utf-8')\ndef fixed_run(api,a,out,directory):\n    points=[];zero_line=False\n    if api=='ratio':\n        delta=F(a['delta']);result=[dict(delta=delta,pi=F(p),beta=delta/F(p)if F(p)else None,defined=bool(F(p)))for p in a['pis']];summary=dict(firstRatio=result[0]['beta'],lastFiniteRatio=next(r['beta']for r in reversed(result)if r['defined']),undefinedRatios=sum(not r['defined']for r in result));points=[(r['pi'],r['beta'],'Defined ratio')for r in result if r['defined']];xlabel='Declared reduced-form first-stage slope pi';ylabel='Exact ratio delta/pi';title='A fixed numerator and shrinking denominator'\n    elif api=='firststage':\n        result=fixed_firststage(a);summary=dict(rows=result['n'],declaredInstruments=result['q'],centeredRank=result['rank'],classicalF=result.get('classicalF'),HC0Wald=result.get('HC0Wald'),twoSLS=result.get('twoSLS'));points=[(r['z'][0],r['x'],'Original rows')for r in result['rows']];xlabel='Proposed instrument Z0, constructed units';ylabel='Regressor X, constructed units';title='First stage; declared Gram and actual row identity'\n    elif api=='ar':\n        delta,pi,beta,c=map(F,[a['delta'],a['pi'],a['beta0'],a['criticalValue']]);S=[[F(v)for v in row]for row in a['covariance']];result=ar(delta,pi,S,beta,c);summary=dict(beta0=beta,nullMoment=result['moment'],nullVariance=result['variance'],statistic=result['statistic'],positiveInfinity=int(result['status']=='positive-infinity'),zeroOverZero=int(result['status']=='undefined-zero-over-zero'),nonrejected=result['accepted']);low,high=F(a['gridLow']),F(a['gridHigh']);grid=[]\n        for i in range(121):\n            b=low+(high-low)*i/120;r=ar(delta,pi,S,b,c);grid.append(dict(beta0=b,**r));points.append((b,r['statistic'],'Finite null statistic'))\n        result=dict(selected=result,grid=grid,scope='Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot');xlabel='Prespecified null beta0';ylabel='AR statistic, missing at undefined/infinite values';title='Null-by-null calculation; omitted plot values remain in full result'\n    elif api=='fieller':\n        delta,pi,c=F(a['delta']),F(a['pi']),F(a['criticalValue']);S=[[F(v)for v in row]for row in a['covariance']];result=fieller(delta,pi,S,c);summary={k:result[k]for k in['A','B','C','discriminant','setType']};summary['criticalValue']=c;points=[(F(-3)+F(i,20),result['A']*(F(-3)+F(i,20))**2+result['B']*(F(-3)+F(i,20))+result['C'],'Exact quadratic')for i in range(121)];xlabel='Null coefficient beta, fixed plot viewport';ylabel='A beta^2 + B beta + C; nonpositive is accepted';title='Whole-real Fieller set from exact polynomial signs';zero_line=True\n    elif api=='overid':\n        result=fixed_overid(a);f=result['firststage'];summary=dict(beta1=result['beta1'],beta2=result['beta2'],J=result['J'],referenceDF=result['referenceDF'],testApplicable=int(result['testApplicable']));low,high=F(-1),F(7)\n        for i in range(81):\n            b=low+(high-low)*i/80;s=[dot([r[j]for r in f['centered']['z']],[y-b*x for y,x in zip(f['centered']['y'],f['centered']['x'])])for j in range(f['q'])];points.append((b,dot(s,mv(result['Ui'],s)),'Fixed-weight criterion'))\n        xlabel='Coefficient beta under the same preliminary weight';ylabel='J(beta) finite weight criterion';title='Optimal-weight refitting; a small minimum is not validity proof'\n    else:\n        models,lineage=sources(Path(directory));rr=models[a['case']];r=study(rr);result=dict(nativeModelRows=rr,computed=r);summary=dict(nativeModelRows=len(rr),completeRows=r['n'],OLS=r['OLS'],twoInstrument2SLS=r['IV'],twoStepGMM=r['GMM'],J=r['J'],scalarZ0Ratio=r['scalar']['ratio']);points=[(v['x'],v['y'],'Complete native rows')for v in rr if None not in[v['y'],v['x'],*v['z']]];xlabel={'country':'CPI inflation, annual percentage points','person':'Schooling years','company':'Starting-wage change, nominal USD/hour'}[a['case']];ylabel={'country':'Real GDP growth, annual percentage points','person':'Recorded log-wage points','company':'FTE change'}[a['case']];title='Actual '+a['case']+'; common frame, proposed instruments'\n    out=Path(out);out.mkdir(parents=True,exist_ok=False)\n    def display(v):\n        if v is None:return'undefined'\n        if isinstance(v,str):return v\n        if isinstance(v,bool):return'1.000000000'if v else'0.000000000'\n        return format(float(v),'.9f')\n    with(out/'summary.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['metric','value']);w.writerows((k,display(v))for k,v in summary.items())\n    with(out/'plot-points.csv').open('w',encoding='utf-8',newline='')as f:\n        w=csv.writer(f,lineterminator='\\n');w.writerow(['x','y','series']);w.writerows((token(x),token(y),s)for x,y,s in points)\n    (out/'full.json').write_text(json.dumps(pack(result),ensure_ascii=False,indent=2)+'\\n',encoding='utf-8');native_svg(out/'plot.svg',points,xlabel,ylabel,title,zero_line);print(', '.join(k+'='+display(v)for k,v in summary.items()))\nif __name__=='__main__':\n    import sys\n    try:fixed_run(API,INPUT,sys.argv[1]if len(sys.argv)>1 else'fixed-result',sys.argv[2]if len(sys.argv)>2 else'../metr18-sources')\n    except(ValueError,ZeroDivisionError)as e:print('Rejected fixed input: '+str(e),file=sys.stderr);sys.exit(2)\n",
        "input": {
          "case": "company"
        },
        "inputFiles": [
          {
            "file": "metr18-sources/actual90-KOR-growth-CPI-original-1980-2024.csv",
            "sha256": "cc2fb516c33bb55a7bad8849f1103ad4a1c375d9f28853cf1a6dc64f4e0334ad"
          },
          {
            "file": "metr18-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "f03c12fe87497fe884212050309d09da77bd07f1b4975730fed1b53e5bb3b23f"
          },
          {
            "file": "metr18-sources/actual410-NJPA-original-codebook-fields.csv",
            "sha256": "abd533f9a11e44fe20c812cdcf8b69291ea498b3089122950854b7fbd4e77a92"
          }
        ],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "nativeModelRows=410.000000000, completeRows=351.000000000, OLS=2.942529547, twoInstrument2SLS=4.473018188, twoStepGMM=4.391749138, J=0.009119155, scalarZ0Ratio=4.517518322\r\n",
        "stderr": "",
        "summary": {
          "nativeModelRows": "410.000000000",
          "completeRows": "351.000000000",
          "OLS": "2.942529547",
          "twoInstrument2SLS": "4.473018188",
          "twoStepGMM": "4.391749138",
          "J": "0.009119155",
          "scalarZ0Ratio": "4.517518322"
        },
        "plotPoints": [
          {
            "x": "1/4",
            "y": "-14",
            "series": "Complete native rows"
          },
          {
            "x": "-3/4",
            "y": "23/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "-83/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "13",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-29",
            "series": "Complete native rows"
          },
          {
            "x": "-1/2",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "-3/4",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/2",
            "y": "9/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "13/4",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "-14",
            "series": "Complete native rows"
          },
          {
            "x": "-3/4",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-25/4",
            "series": "Complete native rows"
          },
          {
            "x": "-1/10",
            "y": "-17",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "-3/4",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-7",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "15/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "13/100",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "-17/100",
            "y": "-18",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "-11/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "-1/2",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-19/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-37/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-15/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-7/4",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-20",
            "series": "Complete native rows"
          },
          {
            "x": "1/10",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "13/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "13/100",
            "y": "12",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "19",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "11/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/10",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-25/2",
            "series": "Complete native rows"
          },
          {
            "x": "13/20",
            "y": "-18",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "13",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-11",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "2",
            "y": "-6",
            "series": "Complete native rows"
          },
          {
            "x": "-3/20",
            "y": "-43/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "9/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "1/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "-5/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "19",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "91/4",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "16",
            "series": "Complete native rows"
          },
          {
            "x": "4/25",
            "y": "-41/4",
            "series": "Complete native rows"
          },
          {
            "x": "3/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/10",
            "y": "-7/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "-7/100",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "-51/100",
            "y": "-35/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-11/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/5",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-19/2",
            "series": "Complete native rows"
          },
          {
            "x": "-9/20",
            "y": "31/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "59/4",
            "series": "Complete native rows"
          },
          {
            "x": "-9/20",
            "y": "1/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "17/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "3/4",
            "series": "Complete native rows"
          },
          {
            "x": "-1/5",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "-9/20",
            "y": "-19/2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "7/25",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "13/100",
            "y": "-23/4",
            "series": "Complete native rows"
          },
          {
            "x": "-1/5",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "-7/100",
            "y": "-91/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "23/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-15/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-11/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-11/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "-57/100",
            "y": "-1/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-7/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-23/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "7",
            "series": "Complete native rows"
          },
          {
            "x": "-1/20",
            "y": "-10",
            "series": "Complete native rows"
          },
          {
            "x": "-1/5",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "-9/20",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "1/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "1/5",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "-9/20",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-25/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/5",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/10",
            "y": "-19",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-7",
            "series": "Complete native rows"
          },
          {
            "x": "-1/100",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "19/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "11/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "-35/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "27/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "-1/4",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/20",
            "y": "-49/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "9",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "13/20",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "17/25",
            "y": "-16",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "17/25",
            "y": "21/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "9/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "17/25",
            "y": "23/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "19/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/5",
            "y": "-13/2",
            "series": "Complete native rows"
          },
          {
            "x": "7/10",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "17/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-23/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/10",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-29/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "8",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-27/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-20",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "37/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "21/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "21/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "8",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-27/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-26",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "13/20",
            "y": "-6",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "-34",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "13/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "43/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-19",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "55/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "19/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "16",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "12",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-19/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "9/4",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "-7",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "7/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "117/100",
            "y": "9/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "24",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "27/25",
            "y": "31/4",
            "series": "Complete native rows"
          },
          {
            "x": "9/50",
            "y": "-11/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "1/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/4",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-15/2",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "1/4",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "9/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/5",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "8",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "33/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "19/50",
            "y": "-13/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "11/2",
            "series": "Complete native rows"
          },
          {
            "x": "7/10",
            "y": "15/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "21/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-37/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "7",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "9/20",
            "y": "-7/2",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "31/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "25/4",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "10",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "7/10",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "9/20",
            "y": "-13/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-9/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "9",
            "series": "Complete native rows"
          },
          {
            "x": "21/20",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "13/4",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "9/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "2/5",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "47/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-17/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "17/25",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "9/50",
            "y": "1/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "14",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-9/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "19/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "28",
            "series": "Complete native rows"
          },
          {
            "x": "3/5",
            "y": "11/2",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "1/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-11/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-7/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "1/4",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "29/2",
            "series": "Complete native rows"
          },
          {
            "x": "7/10",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "33/50",
            "y": "7",
            "series": "Complete native rows"
          },
          {
            "x": "19/20",
            "y": "53/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-1/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "63/100",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "-7/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "37/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "7/4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "9/50",
            "y": "23/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-23/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "-7/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "1/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "21/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "21/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "19/20",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "3/2",
            "series": "Complete native rows"
          },
          {
            "x": "1/5",
            "y": "49/20",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "9/2",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "21/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "63/100",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "53/100",
            "y": "-10",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-9/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "9/50",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-7/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "15/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "5/2",
            "series": "Complete native rows"
          },
          {
            "x": "73/100",
            "y": "-11/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "11/20",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-10",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-3/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-6",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "9/2",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-20",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-5/2",
            "series": "Complete native rows"
          },
          {
            "x": "43/100",
            "y": "7/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "19/2",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "59/4",
            "series": "Complete native rows"
          },
          {
            "x": "1/2",
            "y": "31/4",
            "series": "Complete native rows"
          },
          {
            "x": "4/5",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "3/10",
            "y": "13/2",
            "series": "Complete native rows"
          },
          {
            "x": "13/25",
            "y": "11/2",
            "series": "Complete native rows"
          }
        ],
        "plotFile": "metr18-fixed-results/realdata-company-python/plot.svg",
        "plotSHA256": "8d87dc4f721e03a56f20feda38addf198258cd486aac77a9b716c8f50d39ed99",
        "files": [
          {
            "file": "metr18-fixed-results/realdata-company-python/full.json",
            "sha256": "81eaff665c82efc7d778fc5fd34eb3b071aaae0a067acdb23c681eb445da50fa"
          },
          {
            "file": "metr18-fixed-results/realdata-company-python/plot-points.csv",
            "sha256": "25a7c8fee5f9c1ec1c8e9818cfe27765c96e55c818d07dcbaa456fbfc9d49977"
          },
          {
            "file": "metr18-fixed-results/realdata-company-python/plot.svg",
            "sha256": "8d87dc4f721e03a56f20feda38addf198258cd486aac77a9b716c8f50d39ed99"
          },
          {
            "file": "metr18-fixed-results/realdata-company-python/summary.csv",
            "sha256": "a923543b86d36179b8e5e38f3d77f2768bf5022b2d0571cb3593282ce309679e"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    },
    "r": {
      "country": {
        "api": "realdata",
        "variant": "country",
        "language": "r",
        "codeFile": "metr18-code/realdata-country.R",
        "codeSHA256": "bee6004dcf8f1f2c5584c97749e5f619f98f407e6e5fc32a105a7997eba9b467",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"realdata\"\nINPUT=list(case=\"country\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"realdata\"\nINPUT=list(case=\"country\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "case": "country"
        },
        "inputFiles": [
          {
            "file": "metr18-sources/actual90-KOR-growth-CPI-original-1980-2024.csv",
            "sha256": "cc2fb516c33bb55a7bad8849f1103ad4a1c375d9f28853cf1a6dc64f4e0334ad"
          },
          {
            "file": "metr18-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "f03c12fe87497fe884212050309d09da77bd07f1b4975730fed1b53e5bb3b23f"
          },
          {
            "file": "metr18-sources/actual410-NJPA-original-codebook-fields.csv",
            "sha256": "abd533f9a11e44fe20c812cdcf8b69291ea498b3089122950854b7fbd4e77a92"
          }
        ],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "nativeModelRows=43.000000000, completeRows=43.000000000, OLS=0.474120093, twoInstrument2SLS=1.656546472, twoStepGMM=1.683845567, J=0.009466191, scalarZ0Ratio=1.635861612 \r\n",
        "stderr": "",
        "summary": {
          "nativeModelRows": "43.000000000",
          "completeRows": "43.000000000",
          "OLS": "0.474120093",
          "twoInstrument2SLS": "1.656546472",
          "twoStepGMM": "1.683845567",
          "J": "0.009466191",
          "scalarZ0Ratio": "1.635861612"
        },
        "plotPoints": [
          {
            "x": "7.1908466400686901",
            "y": "8.4682695856582093",
            "series": "Complete native rows"
          },
          {
            "x": "3.4206141949892102",
            "y": "13.466805746552801",
            "series": "Complete native rows"
          },
          {
            "x": "2.2739564000186299",
            "y": "10.636605497672299",
            "series": "Complete native rows"
          },
          {
            "x": "2.4591087921527399",
            "y": "7.9387954776054501",
            "series": "Complete native rows"
          },
          {
            "x": "2.7499809606335699",
            "y": "11.50298504807",
            "series": "Complete native rows"
          },
          {
            "x": "3.04966077087423",
            "y": "12.8922089918574",
            "series": "Complete native rows"
          },
          {
            "x": "7.1460977372160501",
            "y": "12.1331951107172",
            "series": "Complete native rows"
          },
          {
            "x": "5.7001654456140001",
            "y": "7.16501737923842",
            "series": "Complete native rows"
          },
          {
            "x": "8.5732722572867601",
            "y": "10.024899621389901",
            "series": "Complete native rows"
          },
          {
            "x": "9.3327904816149498",
            "y": "10.8749739277708",
            "series": "Complete native rows"
          },
          {
            "x": "6.2132814635518399",
            "y": "6.3515919960644096",
            "series": "Complete native rows"
          },
          {
            "x": "4.8009966021535302",
            "y": "6.99471791742556",
            "series": "Complete native rows"
          },
          {
            "x": "6.2658595003967896",
            "y": "9.3718357757100996",
            "series": "Complete native rows"
          },
          {
            "x": "4.4807410855724799",
            "y": "9.7358937505408996",
            "series": "Complete native rows"
          },
          {
            "x": "4.9245435429275304",
            "y": "7.9904298252683903",
            "series": "Complete native rows"
          },
          {
            "x": "4.4389318457462998",
            "y": "6.2821926537929",
            "series": "Complete native rows"
          },
          {
            "x": "7.5135800807930604",
            "y": "-4.9389297463141002",
            "series": "Complete native rows"
          },
          {
            "x": "0.81295725444636902",
            "y": "11.617262955959101",
            "series": "Complete native rows"
          },
          {
            "x": "2.2591658008015698",
            "y": "9.2018583880478992",
            "series": "Complete native rows"
          },
          {
            "x": "4.0665758789779201",
            "y": "4.7259356032235598",
            "series": "Complete native rows"
          },
          {
            "x": "2.7622621029659902",
            "y": "7.7439989531956899",
            "series": "Complete native rows"
          },
          {
            "x": "3.51487451459939",
            "y": "3.0747266182694699",
            "series": "Complete native rows"
          },
          {
            "x": "3.5906629888257702",
            "y": "5.1836368597333999",
            "series": "Complete native rows"
          },
          {
            "x": "2.75379162735039",
            "y": "4.3582366733715601",
            "series": "Complete native rows"
          },
          {
            "x": "2.2423402851891998",
            "y": "5.2450055058034204",
            "series": "Complete native rows"
          },
          {
            "x": "2.5345738213793201",
            "y": "5.8419633918717002",
            "series": "Complete native rows"
          },
          {
            "x": "4.6738965553340801",
            "y": "3.0044045167956899",
            "series": "Complete native rows"
          },
          {
            "x": "2.75649654493929",
            "y": "0.81986175641795001",
            "series": "Complete native rows"
          },
          {
            "x": "2.9392865265568502",
            "y": "6.9816613885307097",
            "series": "Complete native rows"
          },
          {
            "x": "4.0259650043609003",
            "y": "3.6880320602952001",
            "series": "Complete native rows"
          },
          {
            "x": "2.18707104433313",
            "y": "2.5476655056824198",
            "series": "Complete native rows"
          },
          {
            "x": "1.3013475454741199",
            "y": "3.2913959543442002",
            "series": "Complete native rows"
          },
          {
            "x": "1.2747744640132099",
            "y": "3.2146801968310799",
            "series": "Complete native rows"
          },
          {
            "x": "0.70633177245574896",
            "y": "2.92029267301234",
            "series": "Complete native rows"
          },
          {
            "x": "0.971685739912167",
            "y": "3.1715274898393502",
            "series": "Complete native rows"
          },
          {
            "x": "1.9443323078636601",
            "y": "3.4331917639720002",
            "series": "Complete native rows"
          },
          {
            "x": "1.4758393500264499",
            "y": "3.1761156817732701",
            "series": "Complete native rows"
          },
          {
            "x": "0.38300030360813497",
            "y": "2.3138021059547502",
            "series": "Complete native rows"
          },
          {
            "x": "0.53728802341173698",
            "y": "-0.70024231754210597",
            "series": "Complete native rows"
          },
          {
            "x": "2.4983333333333899",
            "y": "4.6129679545428699",
            "series": "Complete native rows"
          },
          {
            "x": "5.08951365062841",
            "y": "2.7275645670899098",
            "series": "Complete native rows"
          },
          {
            "x": "3.5974562502901",
            "y": "1.58301467403629",
            "series": "Complete native rows"
          },
          {
            "x": "2.3217432864354199",
            "y": "2.0036110183898601",
            "series": "Complete native rows"
          }
        ],
        "plotFile": "metr18-fixed-results/realdata-country-r/plot.svg",
        "plotSHA256": "b3c9c5d8fdc0afeaa200944413b8e1bd60eedbb1fc0e7d2bb97ae48c985e0b48",
        "files": [
          {
            "file": "metr18-fixed-results/realdata-country-r/full-result.Rtext",
            "sha256": "9eefc24a885d441daf8ba2085c4ce360683f4c95eb016d313c35fbb30d8d986a"
          },
          {
            "file": "metr18-fixed-results/realdata-country-r/plot-points.csv",
            "sha256": "032c1ff1be6b3cbd1eb283cf724c74196fa4fde026cf495684dd2f1728b2cfa7"
          },
          {
            "file": "metr18-fixed-results/realdata-country-r/plot.svg",
            "sha256": "b3c9c5d8fdc0afeaa200944413b8e1bd60eedbb1fc0e7d2bb97ae48c985e0b48"
          },
          {
            "file": "metr18-fixed-results/realdata-country-r/summary.csv",
            "sha256": "69488e284a0ed0d2d15a4c1d129ebe80bb746fc789afe770dd3d5a05a2d6c282"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "person": {
        "api": "realdata",
        "variant": "person",
        "language": "r",
        "codeFile": "metr18-code/realdata-person.R",
        "codeSHA256": "ce4c7692a0568f34b8399a802e38e7c72d77a560368f89e1c856c47114d12f7b",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"realdata\"\nINPUT=list(case=\"person\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"realdata\"\nINPUT=list(case=\"person\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "case": "person"
        },
        "inputFiles": [
          {
            "file": "metr18-sources/actual90-KOR-growth-CPI-original-1980-2024.csv",
            "sha256": "cc2fb516c33bb55a7bad8849f1103ad4a1c375d9f28853cf1a6dc64f4e0334ad"
          },
          {
            "file": "metr18-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "f03c12fe87497fe884212050309d09da77bd07f1b4975730fed1b53e5bb3b23f"
          },
          {
            "file": "metr18-sources/actual410-NJPA-original-codebook-fields.csv",
            "sha256": "abd533f9a11e44fe20c812cdcf8b69291ea498b3089122950854b7fbd4e77a92"
          }
        ],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "nativeModelRows=3613.000000000, completeRows=3010.000000000, OLS=0.052094237, twoInstrument2SLS=0.198413333, twoStepGMM=0.199626104, J=3.329200932, scalarZ0Ratio=0.188062635 \r\n",
        "stderr": "",
        "summary": {
          "nativeModelRows": "3613.000000000",
          "completeRows": "3010.000000000",
          "OLS": "0.052094237",
          "twoInstrument2SLS": "0.198413333",
          "twoStepGMM": "0.199626104",
          "J": "3.329200932",
          "scalarZ0Ratio": "0.188062635"
        },
        "plotPoints": [
          {
            "x": "7",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5916737300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3368257300000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4101748799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2441668999999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.3798973500000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7957057799999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4892049299999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8501261700000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4199949299999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4035742000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.2442275199999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.4955419399999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4488893899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.3375380799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1246833900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7141705299999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.54126355",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.8501261700000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0440329000000004",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.7807435199999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.4595855100000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.43615037",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8406416600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8664680599999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4907235300000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4313310799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6039438199999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.6347896000000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.0730445299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5581978000000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3473892100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6066501899999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3835066300000003",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.3612921699999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.3543623299999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6515718699999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3456363600000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4409465399999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3007857899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3561076600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6694980900000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.9196838500000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6306833899999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6454468999999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0414116599999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6970342499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5944134600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3767269500000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.3082677",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7044143500000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4281052699999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2383246300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.0130157899999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.0509894500000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7178047000000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8276292300000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.9810057399999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8023947600000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5250296600000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0185932099999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9127428200000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5861716499999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8793557999999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1569789899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8200829299999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.94803499",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5539334",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.14418563",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8287120699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6758232199999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3456363600000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5581978000000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5424719600000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6025878899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2442275199999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.48310735",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.5797298299999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3868793200000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1420374100000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.6524891799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.72262979",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0030654600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6372580299999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.67834211",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0137151600000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.78897174",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3561076600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.41836494",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2422232700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1246833900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8575140599999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0166096800000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6664266899999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1428273999999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.41836494",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3007857899999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6276211099999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.2737863200000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9027427399999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7546040999999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.53087763",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.7238324399999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4504704200000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5352412700000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5250296600000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.5072777100000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9334230300000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6698809199999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0509894500000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3080984400000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "7.15617664",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3767269500000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1463292599999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8341087399999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3207682900000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9635793399999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.67834211",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1548580900000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.3082677",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.1654178499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4.9126548899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7365722999999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.1869010199999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3117348099999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7810576300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6333184300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5624440899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3561076600000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2747620199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6463905099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9687075600000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6970342499999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2971093199999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.3851943999999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7615727699999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2344107299999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6346333599999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2005091700000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0980742799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4101748799999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "3",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7007311100000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7868973800000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7031881100000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.02553831",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5722825399999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3818160199999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0958245599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1903154100000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.5439118499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.3207682900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5042881699999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.7848892999999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6306833899999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8936563499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.6559918099999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.44241771",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5708829599999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.5525078900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7661917100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8211074700000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9707300800000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4614681799999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6524891799999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9635793399999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9177056099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8824374700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1377270499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2348984200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9939614299999997",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7683210000000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2422232700000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.3375380799999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.0833878500000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5708829599999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3153579999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.36130248",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7345916600000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.5616417499999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6920837400000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8406416600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7298240700000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3332796299999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.2513449799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1737861000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7522703799999997",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.6039438199999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.9641356099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3491389900000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.69084228",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6066501899999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.9375362100000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5424719600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9216581799999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0352686000000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.4436636800000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.9177056099999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7405193600000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5652649700000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7093043400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1025585900000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9555926100000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0917421200000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5366916000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4738907000000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "7.7160152699999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2737863200000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7683210000000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1404530399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6120410300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7405193600000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7007311100000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3297209099999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.6524891799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0799332000000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3630281000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3767269500000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7430031899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8377304499999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3189681100000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5496507399999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.5616417499999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.10332206",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6133842200000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1268691799999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4723462899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6133842200000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7031881100000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4876840199999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7464121300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4967749899999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7900972399999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.44241771",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6871086100000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2785214199999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6528630299999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1654178499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9216581799999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3207682900000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2690962800000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0509894500000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.75110147",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1717006000000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8966943299999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1025585900000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9097532800000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1236727899999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8254600400000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3473892100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0509894500000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1737861000000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.7322107100000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.2456550699999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5652649700000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9610053399999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5337888399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4457198199999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.95081477",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6605751499999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4907235300000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9177056099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.05443935",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9660241899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0258659699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1984787199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.67332327",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5944134600000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1903154100000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8200829299999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5861716499999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8297937400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2422232700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9707300800000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4583382800000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6052979199999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2005091700000001",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4441312599999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0137151600000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6133842200000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3080984400000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7868973800000001",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.5529595799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4599044499999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2225762700000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9177056099999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6656837199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3026189800000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7190131500000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.0689042000000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7170277",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3153579999999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2324480199999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2737863200000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7787848999999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7604146900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6066501899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7900972399999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1268691799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6120410300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7900972399999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4035742000000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6147255999999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3279367799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0497334599999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4707995",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3935907500000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2690962800000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7452363499999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2265366699999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2383246300000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.0369526000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3225652400000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9188938499999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3699009799999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2441668999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9661467400000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6347896000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5366916000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.83481074",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.87493073",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5683445000000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6066501899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.83481074",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.6204008700000001",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4764635500000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3952616000000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4.9904325900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6347896000000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.9177056099999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2480428699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3902406699999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8230459000000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7203117800000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9322451899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5624440899999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0185932099999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "7.1996783500000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5736801700000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.25749537",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6808546800000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8287120699999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.9324478899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2205901700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1654178499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4967749899999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5610306700000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8330317300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4692503200000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9334230300000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.3382381499999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8276292300000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3421214199999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.0175061400000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5680779100000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.8297937400000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6021188200000003",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.7250336400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.09007684",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3647507599999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.53087763",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2859980899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5366916000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5176712700000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1590953900000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4297194800000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9348941999999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.49306144",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0890448800000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5337888399999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2166060999999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8885724599999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5610306700000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9498564600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6346333599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5694814199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.49526556",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2971093199999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4614681799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6937321399999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.8532990900000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4297194800000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6240175099999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5889264799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1420374100000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5652649700000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7250336400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.2737863200000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.2048925099999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2499752400000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1224928099999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.0137151600000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3261494699999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.9334230300000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9865664599999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.0917421200000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.7960577500000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.42833319",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.15617664",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0958245599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1463292599999999",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "6.5042881699999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.6559918099999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.6528630299999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.9612960499999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5161930799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5381398199999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.2737863200000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2025355199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5750758400000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.46614472",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5206211300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2803958399999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9135030100000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4892049299999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.7397929100000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.7345916600000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4922398399999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5581978000000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6767538000000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.2737863200000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0917421200000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "7.3796321499999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.69084228",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9864520099999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.75110147",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8435444199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3297209099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5279579200000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1506027699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5889264799999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6267177500000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4614681799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2619270900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6346333599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0130157899999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6372580299999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.0518556200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3189681100000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2971093199999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7615727699999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.41836494",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2519038800000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5610306700000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7068623399999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5539334",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.1869010199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2106000799999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.4967749899999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9411900600000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.9837899700000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4297194800000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9641356099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3007857899999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6669567900000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1841488900000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5820251399999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5439118499999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3080984400000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6758232199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.5616417499999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6758232199999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.8023947600000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.48310735",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9506425500000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1420365700000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6160651899999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.51025834",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8906091199999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0917421200000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7310181",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.0958245599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2971093199999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6808546800000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.8777357800000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "4.7621739300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2841341599999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2766434899999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.0591232000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9975959799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.5626812499999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7452363499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1612073199999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4861607899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0475172199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8111409900000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5539334",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7730803799999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4614681799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0039741400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8287120699999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5482190999999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3207682900000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3716118499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6605751499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4861607899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.15617664",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4723462899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8437499500000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2859980899999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.6698809199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.25749537",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7068623399999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7007311100000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5889264799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.02553831",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9989365599999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5581978000000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.8200829299999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7250336400000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.25749537",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5930445300000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7129561999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5998704999999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8289456199999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2971093199999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1025585900000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.3798973500000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.8636311799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9157234499999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.48310735",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6883547099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3456363600000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4692503200000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0980742799999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3801225400000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3171646900000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5694814199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6066501899999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5176712700000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6808546800000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2519038800000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.97380961",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8145429000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0776422400000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2653012099999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4205350000000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5666724299999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6682282500000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.12029742",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6240175099999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43615037",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.54678541",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9348941999999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1590953900000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1964441299999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8287120699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.0614569200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9135030100000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2265366699999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4281052699999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9427993800000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3767269500000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1820849100000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.7274317200000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1964441299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8178305699999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.72262979",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0730445299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.44241771",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9788857599999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.07918439",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2166060999999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8171111599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3368257300000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8710912899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2254814700000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4118182700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5072777100000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0980742799999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1841488900000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5652649700000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8596149000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1737861000000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1246833900000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5971456999999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7990926500000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0161571599999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1862086200000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.88332239",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7990926500000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2045577600000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4815771299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5820251399999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.55677836",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2422232700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4329400899999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4815771299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.46614472",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4982821499999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3189681100000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4645883",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1853870200000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2225762700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6605751499999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5279579200000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.44254017",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3171646900000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4035742000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4068799900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9285378199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5708829599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3681871900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5596152400000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4861607899999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5279579200000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6204008700000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5610306700000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6694980900000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1846291500000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5820251399999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6333184300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0730445299999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "7.0833878500000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9135030100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0753460300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8051349700000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4614681799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5820251399999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4982821499999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7990558600000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6758232199999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2897155700000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.7990558600000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8297937400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2304814500000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8341087399999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5581978000000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.5834963100000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.84587988",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6411821700000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5610306700000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5279579200000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5250296600000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8221973900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6039438199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0621916300000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6398758300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4892049299999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3902406699999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.81234509",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9555926100000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.12029742",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8297937400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3332796299999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2298387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6694980900000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9635793399999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.8721177899999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7031881100000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0753460300000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.3278761699999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1841488900000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6320017800000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9027427399999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0621916300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7493929899999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8189240699999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4982821499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6631327000000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.5872486600000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.8721177899999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3332796299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6669567900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0917421200000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0161571599999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9135030100000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6707663200000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.1316985099999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "4.8520302600000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9814142099999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4457198199999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1841488900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3080984400000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9188938499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2519038800000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5944134600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4232469600000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1548580900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0637852099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5872486600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0684255900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2747620199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0030654600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3767269500000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7345916600000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8254600400000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4264884599999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0185932099999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7397929100000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.49306144",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5134287500000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5381398199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1070228899999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.1308988299999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.19440539",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.37331979",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.7868973800000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0637852099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3473892100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4118182700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5694814199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5652649700000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.0354814299999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4134589599999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6424868000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4297194800000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2461067699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4645883",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2519038800000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3421214199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8855096700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6580110499999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0935697700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.65027905",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8023947600000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1841488900000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7957057799999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.9612960499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8384052000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3421214199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8946700400000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4738907000000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1070228899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3630281000000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.0751738199999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7638849099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5264948599999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0166096800000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0030654600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6559918099999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.94601399",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7365722999999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8141305299999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2499752400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5638555299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4345465199999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6970934900000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1290502099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9814142099999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3868793200000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.94601399",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5482190999999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5694814199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9641356099999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3801225400000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4504704200000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6694980900000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7238324399999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2897155700000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5820251399999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1136821799999996",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.97380961",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8966943299999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7799219099999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.80793494",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.87493073",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6276211099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6094717999999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.4019171999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0030654600000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8200829299999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6293632499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3171646900000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.0684255900000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6808546800000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6933236699999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8384052000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4345465199999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.79301361",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.8276292300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.29156914",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1290502099999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1841488900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2225762700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8944028299999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.48310735",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5012582099999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7787848999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5323342899999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.99645209",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0591232000000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5861716499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6592939199999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.5759490999999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8875525700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.8406416600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3332796299999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.1377270499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3368257300000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4583382800000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5072777100000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.9215784200000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3243589599999996",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3243589599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7990926500000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7557689200000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.4722706700000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8777357800000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1779441100000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8617113400000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6698809199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7202201600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3935907500000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4297194800000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1484683000000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6333184300000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3279367799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0185932099999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.1873858100000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1685799000000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1654178499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6528630299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5708829599999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.0614569200000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0753460300000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0497334599999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1923624899999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8289456199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3647507599999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2441668999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9593985099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.3145528300000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8021183799999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.98393628",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7405193600000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6320017800000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9373140800000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7753660900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3421214199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2785214199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4035742000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4876840199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6347896000000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.7068623399999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.43615037",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.4035742000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5132301100000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7787848999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.67456139",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7899601699999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6669567900000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.8200829299999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.0614569200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8916259000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6133842200000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.8435444199999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3171646900000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.5721540300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6133842200000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3007857899999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43615037",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7007311100000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1841488900000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7345916600000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1675164899999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2441668999999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.5451774399999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5764695700000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6795991900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0378709199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0661080900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5294188399999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3117348099999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5610306700000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2595814599999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.98393628",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7707894199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9348941999999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8971538700000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.29156914",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8861040300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "2",
            "y": "5.8435444199999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.95844839",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2971093199999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0917421200000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.63835467",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4.8441870900000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2392149699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0402547100000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.12029742",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4937538400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1136821799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2126061000000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.1420374100000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9080829399999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1246833900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.6664266899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4116460499999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.8944028299999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.4337220000000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.4553211199999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1420374100000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.6415644399999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5191472900000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5539334",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8721177899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2519038800000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.88332239",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8550719200000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6801726099999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0935697700000002",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.5984219599999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3902406699999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2747620199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3818160199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2205901700000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.2254814700000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5539334",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0958245599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3279367799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7365722999999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.1459844700000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3681871900000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "4.7184988700000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.5616417499999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5012582099999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "7.0509894500000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.4662275600000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5930445300000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6012301200000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.6454468999999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0282785199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2576675899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5596152400000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0137151600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0306852600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6669567900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1696107299999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6594822200000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.54126355",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2614916799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6767538000000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.81234509",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.8664680599999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.0518556200000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6605751499999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0306852600000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8971538700000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8805329899999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2690962800000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.70044357",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.29156914",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.2690962800000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.2882670300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6240652300000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0980742799999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "3",
            "y": "5.1179938099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0980742799999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9864520099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2595814599999997",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.5984219599999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7365722999999997",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8023947600000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.6524891799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6276211099999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.9712618400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2363695899999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43615037",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4971682299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8944028299999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4068799900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6333184300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2045577600000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7190131500000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.5872486600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7071102600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4892049299999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2422232700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7203117800000003",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.0637852099999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "4.6051701899999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.2364419599999996",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.8721177899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5872486600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5872486600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.37331979",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3007857899999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3315018500000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.79122146",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0306852600000003",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "6.5264948599999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7365722999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4982821499999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.6559918099999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6093492400000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4345465199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4019171999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7990926500000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5279579200000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9948499899999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1654178499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8564619799999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0405363899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1047932300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4232469600000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.19440539",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0282785199999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0518556200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3243589599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8607862199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5834092200000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3438804299999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8230459000000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6629604799999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7428806400000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7730803799999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.6869753599999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6664266899999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.6970934900000003",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0003344600000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1420374100000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.5797298299999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7322107100000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4595855100000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.27811466",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.8111409900000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1180972000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8511849299999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.67332327",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1612073199999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.6903594499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0402547100000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2519038800000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7557422100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.8501261700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.97380961",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1984787199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.5909869800000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.63835467",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5721540300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9196838500000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7250336400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7651911",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0354814299999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2672005500000001",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2519038800000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8141305299999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.75110147",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7557422100000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.72262979",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.2254814700000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1114673399999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5279579200000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0753460300000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.75110147",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5451774399999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0890448800000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0038870700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0161571599999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9196838500000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1136821799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9610053399999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1984787199999998",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4846352400000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5638555299999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2363695899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0258659699999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1548580900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.19440539",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6133842200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7683210000000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4068799900000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3332796299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7105231099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6970342499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9242558000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4281052699999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3716118499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3750248200000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2785214199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4846352400000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.42486902",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4002574499999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.53087763",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.0304379199999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3885614100000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7170277",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6419070700000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5666724299999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.86589107",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0958245599999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.4595855100000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5294290899999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9661467400000001",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.6629604799999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8861040300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.97380961",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.2364419599999996",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.6524891799999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.6463905099999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3243589599999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.4747721800000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5439118499999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1923624899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2324480199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7068623399999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.2285110000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4068799900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7007311100000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6524891799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9735430200000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.3993980800000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7569323900000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.62804138",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.0085051800000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.67332327",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8051349700000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2538288099999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.0106352899999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7957057799999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7776523199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.4847969299999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.6306833899999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.5903469499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5439118499999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1964441299999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3368257300000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.8289456199999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6970934900000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "7.0003344600000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4068799900000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3784261799999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9661467400000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0935697700000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5610306700000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6567265200000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2344107299999996",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.0913098799999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1507014599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0038870700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6347896000000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.6024013400000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7638849099999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.7799219099999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4134589599999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4.9972122700000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7141705299999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2441668999999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5680779100000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.7393366300000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7855876500000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7464121300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6039438199999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.67834211",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.36130248",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7673431300000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.2334554200000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.3796321499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4967749899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7393366300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4876840199999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "7.09007684",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6463905099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8377304499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.6568100899999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9363427399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5694814199999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3885614100000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.7250336400000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.1179938099999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1463292599999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.46614472",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5012896700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3153579999999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6656837199999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5027900499999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.54678541",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5294188399999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0258659699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6214056499999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.44241771",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.1770187700000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9641356099999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4409465399999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9565454400000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.8906091199999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.15617664",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7068623399999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5792512099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8437499500000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6605751499999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9037472600000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3664704499999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.44241771",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2897155700000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.44254017",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5132301100000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.44241771",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5736801700000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6559918099999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.7430031899999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0085051800000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3681871900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4264884599999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6240175099999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5395859600000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3332796299999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "7.1974353500000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7522703799999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4393503699999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2744795599999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8171111599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1737861000000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1717006000000003",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.9450510599999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9939329800000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7683210000000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8493247799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7580945000000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6419070700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5496507399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2803958399999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7369669600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3153579999999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.9216581799999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.64768837",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8145429000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6133842200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5132301100000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6463905099999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5889264799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5012896700000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5337888399999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3279367799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5072777100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5875500100000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "7.0509894500000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0450053099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9688503800000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0690234299999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.7475865300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4134589599999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.09007684",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.9363427399999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2971093199999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.75110147",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5903010499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.9324478899999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "7.0509894500000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8906091199999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5889264799999996",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2766434899999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.6664266899999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0030654600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4922398399999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.5721540300000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.54126355",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5072777100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9555926100000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "7.5207764199999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5337888399999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1717006000000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.83188248",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.8090393100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8607862199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6528630299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3835066300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6066501899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2785214199999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.2399325899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.4876840199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3491389900000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43615037",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0913098799999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.29156914",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.7345916600000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5847913900000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3225652400000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8111409900000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.2344107299999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2363695899999998",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7397929100000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5072777100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4473058600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5012896700000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4723462899999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.8435444199999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7334018899999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8232861199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5930445300000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1047932300000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1800166499999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0185932099999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7855876500000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5971456999999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1290502099999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5496507399999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.6656837199999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8297937400000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1070228899999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5264948599999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2576675899999996",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2934192800000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7475865300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3044488000000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.9735430200000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.6052979199999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "7.2984451000000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8023947600000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.29156914",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6720329500000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3403593000000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.87493073",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2747620199999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "4.9698133000000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1862086200000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3935907500000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6995003400000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9498564600000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6846117300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6995003400000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.6214056499999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.6835797699999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0567840100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6489742400000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1737861000000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9348941999999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2304814500000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5834092200000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "7.0917421200000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3332796299999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.57786136",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9865664599999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.6214056499999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.87493073",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9939614299999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.6594822200000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7333412800000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3595738700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.1532915900000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1779441100000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7250336400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6312117800000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "4.9767337400000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.70563909",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.01126717",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2653012099999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3595738700000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4297194800000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3630281000000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0518556200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4232469600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5694814199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7776523199999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.9450510599999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1964441299999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9610053399999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.6025878899999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3952616000000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.0308574799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3985949299999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6970934900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4595855100000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.54678541",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6698809199999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.5093883400000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4861607899999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5666724299999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3902406699999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.3595738700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5191472900000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.3382381499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7569323900000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.2803958399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7300997799999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.29156914",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8406416600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7683210000000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9348941999999996",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.2364419599999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.1239639800000001",
            "series": "Complete native rows"
          },
          {
            "x": "2",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "3",
            "y": "5.2470240700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.9077552799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3350542499999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.43615037",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5708829599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8721177899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4806389199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0354814299999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.9334230300000002",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.6869753599999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2878585600000001",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5666724299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.4337220000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7365722999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7683210000000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7137328099999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6240652300000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7405193600000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1717006000000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0614569200000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.19440539",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7397929100000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.6021188200000003",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9427993800000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1420374100000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.12029742",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5581978000000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6629604799999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0614569200000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2747620199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0867747300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1246833900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.04737218",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0402547100000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5708829599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9864520099999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.9864520099999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5985090299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5337888399999997",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.3565862700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.12029742",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5496507399999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8971538700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4313310799999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.83188248",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.1923624899999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8998973499999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.5490760799999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.6629604799999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.7638849099999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3062752900000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.0707377300000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3044488000000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8721177899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7428806400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6664266899999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1246833900000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5666724299999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4754327199999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4504704200000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3835066300000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6385677899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.88332239",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9989365599999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1377270499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9814142099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6276211099999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0282785199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "7.2737863200000001",
            "series": "Complete native rows"
          },
          {
            "x": "4",
            "y": "4.8283137399999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2557500399999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.5834963100000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.8289456199999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.3659760199999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5337888399999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.1246833900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4216222700000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.59578051",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.0937501999999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1984787199999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3543700400000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2344107299999996",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.3368257300000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.2441668999999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.1548580900000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8141305299999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4645883",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.35088572",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8861040300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8260001099999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.3630281000000002",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7714411200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.0980742799999996",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.5294290899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0378709199999996",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.7589017699999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3153579999999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5916737300000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7493929899999996",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.3936275499999997",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.4595855100000001",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9401712499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9661467400000001",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.5117453300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1800166499999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "4",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1420374100000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2690962800000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0980742799999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.5797298299999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7620513799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4393503699999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.9348941999999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6883547099999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1025585900000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7651911",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.9939614299999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.0330862200000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4232469600000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8692969100000001",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5797298299999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.05443935",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3279367799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6664266899999998",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.97380961",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.8464387799999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.15617664",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.7627295099999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5806391399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.0434251200000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0063531599999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.7405193600000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6080006300000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.5889264799999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.8772960699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6214056499999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0014148799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4232469600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "4.9558270599999998",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0450053099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.4769723600000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.51025834",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "5.8692969100000001",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1312264900000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0684255900000004",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8021183799999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3716118499999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7683210000000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6039438199999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.4630294599999996",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0063531599999997",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.1704840000000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6767538000000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.6858609500000004",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2822667499999998",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.0450053099999996",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3243589599999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1862086200000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8944028299999998",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "4.9558270599999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1047932300000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5596152400000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2803958399999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5147126899999996",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.5606816300000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.1024993600000004",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.9763509099999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.6167711000000002",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.87493073",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.7855876500000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.25749537",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.0402547100000001",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.8971538700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8664680599999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.0306852600000003",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.3969296599999996",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8803840799999998",
            "series": "Complete native rows"
          },
          {
            "x": "5",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7397929100000002",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.6131281099999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.0753460300000004",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "6.5944134600000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.5984219599999996",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.1704840000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0591232000000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6066501899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5510803400000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5012582099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.6094717999999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.4488893899999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6664266899999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.43807931",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.9788857599999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.3491389900000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3099182799999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.8944028299999998",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "4.6051701899999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.6698809199999998",
            "series": "Complete native rows"
          },
          {
            "x": "4",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "6.7250336400000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.0753460300000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8081424899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7235851000000002",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.35088572",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.6629604799999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1377270499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9635793399999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "7.0085051800000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.5012582099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8805329899999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.8777357800000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9914645499999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3153579999999998",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0137151600000003",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8200829299999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.6347896000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2595814599999997",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.5381398199999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0520891700000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "5.8888779600000003",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2952659999999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.64509097",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2245584300000001",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.3818160199999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.0378709199999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "5.91079664",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.0822189099999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4281052699999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.77422389",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.4536249999999997",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "5.7462031900000001",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.85793315",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.7534379199999997",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.94803499",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5012582099999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.69456206",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.2265366699999998",
            "series": "Complete native rows"
          },
          {
            "x": "17",
            "y": "6.8690144499999999",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.6106960399999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.1654178499999999",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "4.8121843599999998",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "6.6770834600000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.1355648900000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.4161004000000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.3578422699999999",
            "series": "Complete native rows"
          },
          {
            "x": "8",
            "y": "5.1929568499999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.78382518",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.0137151600000003",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2897155700000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.8692969100000001",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.52146092",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.5410300000000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.0402547100000001",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9026333299999996",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8607862199999996",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.8167358800000004",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.8023947600000003",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.7268477500000001",
            "series": "Complete native rows"
          },
          {
            "x": "7",
            "y": "6.1633148000000002",
            "series": "Complete native rows"
          },
          {
            "x": "11",
            "y": "5.8289456199999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.1377270499999996",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.2983173700000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "5.7525726400000003",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.43775165",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5373342699999997",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.9269260299999997",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8971538700000004",
            "series": "Complete native rows"
          },
          {
            "x": "18",
            "y": "6.6200732100000002",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.3784261799999999",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.5797298299999998",
            "series": "Complete native rows"
          },
          {
            "x": "9",
            "y": "5.7037824700000002",
            "series": "Complete native rows"
          },
          {
            "x": "6",
            "y": "5.9661467400000001",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1092475799999999",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.5721540300000001",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.0684255900000004",
            "series": "Complete native rows"
          },
          {
            "x": "10",
            "y": "5.25749537",
            "series": "Complete native rows"
          },
          {
            "x": "14",
            "y": "6.7202201600000002",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.2402758499999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2709884300000001",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "5.9532433300000003",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "15",
            "y": "6.5680779100000004",
            "series": "Complete native rows"
          },
          {
            "x": "16",
            "y": "6.1569789899999998",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.1527326899999997",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.02344759",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "5.8141305299999999",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.1758672700000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.2146081000000004",
            "series": "Complete native rows"
          },
          {
            "x": "12",
            "y": "6.5694814199999998",
            "series": "Complete native rows"
          },
          {
            "x": "13",
            "y": "6.2633982599999998",
            "series": "Complete native rows"
          }
        ],
        "plotFile": "metr18-fixed-results/realdata-person-r/plot.svg",
        "plotSHA256": "44a409a878f55df15ab225617ebc0d1ff117ce7b1927949ed2b8ff95f4c57621",
        "files": [
          {
            "file": "metr18-fixed-results/realdata-person-r/full-result.Rtext",
            "sha256": "2c59b819ee703c7bf759d39fc18191262c69b1c8cd8b17159054b8427aaa2c84"
          },
          {
            "file": "metr18-fixed-results/realdata-person-r/plot-points.csv",
            "sha256": "384c33576ee2342c2c9a14419969cc2aa9f8a3f7470b7dcbd1239529bd79c984"
          },
          {
            "file": "metr18-fixed-results/realdata-person-r/plot.svg",
            "sha256": "44a409a878f55df15ab225617ebc0d1ff117ce7b1927949ed2b8ff95f4c57621"
          },
          {
            "file": "metr18-fixed-results/realdata-person-r/summary.csv",
            "sha256": "284157eb7f9be0968e96493b56626454e7f9fdb643c0b1ff0032149c0211c10d"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      },
      "company": {
        "api": "realdata",
        "variant": "company",
        "language": "r",
        "codeFile": "metr18-code/realdata-company.R",
        "codeSHA256": "696c3f54f003f21e485aef9a8482c515e1bf63e9a8ffe829a36716a0c531400d",
        "codeText": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"realdata\"\nINPUT=list(case=\"company\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "code": "#!/usr/bin/env Rscript\n# METR18 standalone fixed input. Base R approximate binary64, not an exact engine.\nq<-function(v)vapply(v,function(s){if(is.na(s)||s==\"\"||s==\".\")return(NA_real_);p<-strsplit(s,\"/\",fixed=TRUE)[[1]];if(length(p)>2)stop(\"malformed fraction\");a<-suppressWarnings(as.numeric(p[1]));if(is.na(a))stop(\"malformed number\");if(length(p)==1)return(a);b<-as.numeric(p[2]);if(!is.finite(b)||b==0)stop(\"invalid denominator\");a/b},numeric(1),USE.NAMES=FALSE)\nfmt<-function(x){if(length(x)!=1)stop(\"scalar required\");if(is.na(x))return(\"\");if(is.logical(x))return(if(x)\"True\"else\"False\");if(is.numeric(x))return(sprintf(\"%.17g\",x));as.character(x)}\nar<-function(delta,pi,S,b,c=4){g<-delta-b*pi;v<-S[1,1]-2*b*S[1,2]+b*b*S[2,2];if(v<0)stop(\"negative variance\");stat<-if(v)g*g/v else NA_real_;list(moment=g,variance=v,statistic=stat,status=if(v)\"finite\"else if(g)\"positive-infinity\"else\"undefined-zero-over-zero\",accepted=if(v)stat<=c else if(g)FALSE else NA)}\nfieller<-function(delta,pi,S,c=4){if(S[1,1]<=0||det(S)<=0)stop(\"Fieller requires PD covariance\");A<-pi*pi-c*S[2,2];B<--2*delta*pi+2*c*S[1,2];C<-delta*delta-c*S[1,1];disc<-B*B-4*A*C;center<-rad<-lo<-hi<-NA_real_\n if(A!=0){if(disc<0)shape<-if(A<0)\"all-real\"else\"empty\"else if(disc==0){center<--B/(2*A);shape<-if(A<0)\"all-real\"else\"singleton\";lo<-hi<-center}else{center<--B/(2*A);rad<-disc/(4*A*A);lo<-center-sqrt(rad);hi<-center+sqrt(rad);shape<-if(A<0)\"two-rays\"else\"bounded-interval\"}}\n else if(B!=0){center<--C/B;shape<-if(B>0)\"left-half-line\"else\"right-half-line\";if(B>0)hi<-center else lo<-center}else shape<-if(C<=0)\"all-real\"else\"empty\"\n list(A=A,B=B,C=C,discriminant=disc,setType=shape,rootCenter=center,rootRadicand=rad,lowerApprox=lo,upperApprox=hi,endpointApproximation=\"binary64 approximation; exact Python polynomial determines membership\",threshold=c,covarianceConvention=\"estimated independent-row HC0, no degrees correction\",probabilityCoverage=\"not automatically95%; threshold4is stipulated\")}\nstudy<-function(rows){good<-rows[vapply(rows,function(r)!anyNA(c(r$y,r$x,r$z)),logical(1))];n<-length(good);Y<-vapply(good,function(r)r$y,numeric(1));X<-vapply(good,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(good,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);Gi<-solve(G);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));thetaX<-drop(Gi%*%ZX);thetaY<-drop(Gi%*%ZY);xf<-drop(z%*%thetaX);yf<-drop(z%*%thetaY);Sxx<-sum(x*x);Sxy<-sum(x*y);projected<-sum(ZX*thetaX);ols<-Sxy/Sxx;iv<-sum(ZX*thetaY)/projected;u1<-y-iv*x;v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);U<-crossprod(z*u1);Ui<-solve(U);beta2<-drop(crossprod(ZX,Ui%*%ZY)/crossprod(ZX,Ui%*%ZX));u2<-y-beta2*x;mom<-drop(crossprod(z,u2));J<-drop(crossprod(mom,Ui%*%mom));HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-drop(crossprod(thetaX,solve(HC0,thetaX)));ff<-(SSR/2)/(SSE/(n-3));zz<-z[,1];szz<-sum(zz*zz);delta<-sum(zz*y)/szz;pi<-sum(zz*x)/szz;uy<-y-delta*zz;ux<-x-pi*zz;Sigma<-crossprod(cbind(zz*uy,zz*ux))/szz^2\n predictions<-lapply(seq_len(n),function(i)list(id=good[[i]]$id,y=Y[i],x=X[i],z0=Z[i,1],z1=Z[i,2],yCentered=y[i],xCentered=x[i],z0Centered=z[i,1],z1Centered=z[i,2],firststageFit=mx+xf[i],firststageResidual=v[i],reducedFormYFit=my+yf[i],OLSFit=my+ols*x[i],IVFit=my+iv*x[i],IVResidual=u1[i],GMMFit=my+beta2*x[i],GMMResidual=u2[i],scalarYResidual=uy[i],scalarXResidual=ux[i]))\n list(n=n,q=2,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,Gi=Gi,ZX=ZX,ZY=ZY,thetaX=thetaX,thetaY=thetaY,HC0Firststage=HC0,Sxx=Sxx,Sxy=Sxy,SSR=SSR,SSE=SSE,R2=SSR/Sxx,Fclassic=ff,HC0FirststageWald=wald,OLS=ols,IV=iv,IVIntercept=my-iv*mx,U=U,Ui=Ui,S=U/n,W=n*Ui,GMM=beta2,GMMIntercept=my-beta2*mx,J=J,degreesOfFreedom=1,JReference=\"chi-square(q-1)only under validity,strongidentification,CLT,consistentoptimalweight\",scalar=list(delta=delta,pi=pi,ratio=delta/pi,Sigma=Sigma,fieller=fieller(delta,pi,Sigma)),predictions=predictions)}\nload_actual<-function(source_dir){\nread_native<-function(n)read.csv(file.path(source_dir,n),colClasses=\"character\",check.names=FALSE,na.strings=NULL,stringsAsFactors=FALSE)\nadd<-function(...)invisible(NULL) # Native loader does not export the optional country lineage table here.\nwb<-read_native(\"actual90-KOR-growth-CPI-original-1980-2024.csv\")\nlookup<-function(year,indicator){r<-wb[wb$year==as.character(year)&wb$indicatorID==indicator,,drop=FALSE];if(!nrow(r))return(NULL);stopifnot(nrow(r)==1);r}\ncountry<-list();growth<-\"NY.GDP.MKTP.KD.ZG\";cpi<-\"FP.CPI.TOTL.ZG\"\nfor(year in 1980:2024){Y<-lookup(year,growth);X<-lookup(year,cpi);lags<-lapply(c(1,2),function(j)lookup(year-j,growth));lv<-vapply(lags,function(r)if(is.null(r))NA_real_ else q(r$valueExactToken),numeric(1));ls<-vapply(lags,function(r)if(is.null(r))\"\"else r$originalSourceRow,character(1));add(\"country-lag-lineage\",list(year=year,y=q(Y$valueExactToken),x=q(X$valueExactToken),z0=lv[1],z1=lv[2],ySource=Y$originalSourceRow,xSource=X$originalSourceRow,z0Source=ls[1],z1Source=ls[2],inDeclaredModel=year>=1982,reason=if(year<1982)\"prior-two-year-lags-required\"else\"\"));if(year>=1982)country[[length(country)+1L]]<-list(id=paste0(\"KOR:\",year),sourceRow=year,nativeID=\"KOR\",y=q(Y$valueExactToken),x=q(X$valueExactToken),z=lv)}\nnl<-read_native(\"actual3613-NLS-original52-fields.csv\");people<-lapply(seq_len(nrow(nl)),function(i)list(id=paste0(\"nls-row:\",i),sourceRow=i,nativeID=nl$id[i],y=q(nl$lwage76[i]),x=q(nl$ed76[i]),z=c(q(nl$nearc4[i]),q(nl$nearc2[i]))))\nnj<-read_native(\"actual410-NJPA-original-codebook-fields.csv\");company<-lapply(seq_len(nrow(nj)),function(i){r<-nj[i,,drop=FALSE];fte<-function(suffix){v<-vapply(c(\"EMPFT\",\"NMGRS\",\"EMPPT\"),function(k)q(r[[paste0(k,suffix)]]),numeric(1));if(anyNA(v))NA_real_ else v[1]+v[2]+v[3]/2};a<-fte(\"\");b<-fte(\"2\");list(id=paste0(\"njpa-row:\",i),sourceRow=i,nativeID=r$SHEET,y=b-a,x=q(r$WAGE_ST2)-q(r$WAGE_ST),z=c(q(r$STATE),q(r$CO_OWNED)))})\nmodels<-list(country=country,person=people,company=company)\n\nreturn(models)\n}\n\nAPI=\"realdata\"\nINPUT=list(case=\"company\")\n# New owned fixed-program handlers. Binary64 finite examples, not an exact\n# rational engine or an independent statistical certification.\nfixed_firststage<-function(a){rows<-lapply(a$rows,function(r)list(id=r$id,y=q(r$y),x=q(r$x),z=q(unlist(r$z))));n<-length(rows);p<-length(rows[[1]]$z);Y<-vapply(rows,function(r)r$y,numeric(1));X<-vapply(rows,function(r)r$x,numeric(1));Z<-do.call(rbind,lapply(rows,function(r)r$z));my<-mean(Y);mx<-mean(X);mz<-colMeans(Z);y<-Y-my;x<-X-mx;z<-sweep(Z,2,mz,\"-\");G<-crossprod(z);ZX<-drop(crossprod(z,x));ZY<-drop(crossprod(z,y));rank<-qr(G,tol=1e-12)$rank;r<-list(rows=rows,n=n,q=p,means=list(y=my,x=mx,z=mz),centered=list(y=y,x=x,z=z),G=G,ZX=ZX,ZY=ZY,rank=rank,defined=rank==p,reason=if(rank==p)NULL else\"singular declared Gram; remove redundant columns explicitly, not proof of an unidentified instrument span\");if(rank!=p)return(r);Gi<-solve(G);sx<-drop(Gi%*%ZX);sy<-drop(Gi%*%ZY);xf<-drop(z%*%sx);v<-x-xf;SSR<-sum(xf*xf);SSE<-sum(v*v);Sxx<-sum(x*x);ident<-sum(ZX*sx);HC0<-Gi%*%crossprod(z*v)%*%Gi;wald<-tryCatch(drop(crossprod(sx,solve(HC0,sx))),error=function(e)NA_real_);c(r,list(Gi=Gi,thetaX=sx,thetaY=sy,fittedX=mx+xf,firststageResidual=v,SSR=SSR,SSE=SSE,R2=if(Sxx)SSR/Sxx else NA_real_,classicalF=if(SSE&&n>p+1)(SSR/p)/(SSE/(n-p-1))else NA_real_,classicalResidualDF=n-p-1,HC0=HC0,HC0Wald=wald,twoSLS=if(ident)sum(ZX*sy)/ident else NA_real_,identifyingDenominator=ident))}\nfixed_overid<-function(a){f<-fixed_firststage(a);if(!f$defined||!f$identifyingDenominator)return(list(firststage=f,defined=FALSE,reason=\"declared-frame-identification-unavailable\"));z<-f$centered$z;x<-f$centered$x;y<-f$centered$y;beta1<-f$twoSLS;U<-crossprod(z*(y-beta1*x));Ui<-tryCatch(solve(U),error=function(e)NULL);if(is.null(Ui))return(list(firststage=f,defined=FALSE,reason=\"singular preliminary moment covariance\"));beta2<-drop(crossprod(f$ZX,Ui%*%f$ZY)/crossprod(f$ZX,Ui%*%f$ZX));s<-drop(crossprod(z,y-beta2*x));J<-drop(crossprod(s,Ui%*%s));list(firststage=f,defined=TRUE,beta1=beta1,beta2=beta2,U=U,Ui=Ui,S=U/f$n,W=f$n*Ui,sumMoments=s,J=J,referenceDF=f$q-1,testApplicable=f$q>1,scope=\"J reference requires valid moments, strong identification, CLT and consistent optimal weight; q1has no overidentifying restriction\")}\nnative_svg<-function(path,points,xlabel,ylabel,title,zero_line=FALSE){good<-points[is.finite(points$x)&is.finite(points$y),,drop=FALSE];xs<-good$x;ys<-c(good$y,if(zero_line)0 else numeric(0));lo<-min(xs);hi<-max(xs);bottom<-min(ys);top<-max(ys);dx<-if(hi==lo)1 else hi-lo;dy<-if(top==bottom)1 else top-bottom;lo<-lo-dx*.04;hi<-hi+dx*.04;if(bottom>=0&&(grepl(\"AR\",ylabel,fixed=TRUE)||grepl(\"J(\",ylabel,fixed=TRUE)||grepl(\"ratio\",ylabel,fixed=TRUE)))bottom<-0 else bottom<-bottom-dy*.06;top<-top+dy*.06;X<-function(x)100+(x-lo)/(hi-lo)*620;Y<-function(y)336-(y-bottom)/(top-bottom)*266;esc<-function(v){s<-gsub(\"&\",\"&amp;\",as.character(v),fixed=TRUE);s<-gsub(\"<\",\"&lt;\",s,fixed=TRUE);s<-gsub(\">\",\"&gt;\",s,fixed=TRUE);gsub('\"',\"&quot;\",s,fixed=TRUE)};series<-unique(good$series);colors<-c(\"#245b85\",\"#ad551f\",\"#39754f\");nodes<-c(paste0('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"780\" height=\"450\" viewBox=\"0 0 780 450\" role=\"img\"><title>',esc(title),'</title><rect width=\"780\" height=\"450\" fill=\"white\"/><g fill=\"#172936\" font-family=\"Arial,sans-serif\" font-size=\"13\"><text x=\"100\" y=\"26\" font-size=\"15\">',esc(title),'</text>'))\n for(i in 0:3){xx<-lo+(hi-lo)*i/3;yy<-bottom+(top-bottom)*i/3;nodes<-c(nodes,paste0('<path d=\"M',sprintf('%.7f',X(xx)),' 70V336\" stroke=\"#e5e9ed\"/><text x=\"',sprintf('%.7f',X(xx)),'\" y=\"358\" text-anchor=\"',if(i==0)'start'else if(i==3)'end'else'middle','\">',esc(sprintf('%.4g',xx)),'</text>'),paste0('<path d=\"M100 ',sprintf('%.7f',Y(yy)),'H720\" stroke=\"#e5e9ed\"/><text x=\"90\" y=\"',sprintf('%.7f',Y(yy)+4),'\" text-anchor=\"end\">',esc(sprintf('%.4g',yy)),'</text>'))}\n nodes<-c(nodes,'<path d=\"M100 70V336H720\" fill=\"none\" stroke=\"#334655\"/>');if(zero_line)nodes<-c(nodes,paste0('<path d=\"M100 ',sprintf('%.7f',Y(0)),'H720\" stroke=\"#ad551f\" stroke-dasharray=\"5 4\"/>'))\n for(i in seq_len(nrow(good))){p<-good[i,];nodes<-c(nodes,paste0('<circle cx=\"',sprintf('%.7f',X(p$x)),'\" cy=\"',sprintf('%.7f',Y(p$y)),'\" r=\"',if(nrow(good)>200)'1.8'else'3','\" fill=\"',colors[(match(p$series,series)-1)%%3+1],'\" fill-opacity=\"0.65\"><title>',esc(paste0(p$series,' | x=',fmt(p$x),' | y=',fmt(p$y))),'</title></circle>'))}\n nodes<-c(nodes,paste0('<text x=\"410\" y=\"392\" text-anchor=\"middle\">',esc(xlabel),'</text>'),paste0('<text x=\"20\" y=\"204\" text-anchor=\"middle\" transform=\"rotate(-90 20 204)\">',esc(ylabel),'</text>'));for(i in seq_along(series))nodes<-c(nodes,paste0('<circle cx=\"',110+230*(i-1),'\" cy=\"425\" r=\"4\" fill=\"',colors[(i-1)%%3+1],'\"/><text x=\"',120+230*(i-1),'\" y=\"429\">',esc(series[i]),'</text>'));writeLines(c(nodes,'</g></svg>'),path,useBytes=TRUE)}\nfixed_run<-function(api,a,out,directory){points<-list();add<-function(x,y,s)points[[length(points)+1L]]<<-data.frame(x=unname(x),y=unname(y),series=s,stringsAsFactors=FALSE);zero_line<-FALSE\n if(api==\"ratio\"){delta<-q(a$delta);result<-lapply(a$pis,function(p){pi<-q(p);list(delta=delta,pi=pi,beta=if(pi)delta/pi else NA_real_,defined=pi!=0)});defined<-vapply(result,function(r)r$defined,logical(1));summary<-list(firstRatio=result[[1]]$beta,lastFiniteRatio=tail(result[defined],1)[[1]]$beta,undefinedRatios=sum(!defined));for(r in result)if(r$defined)add(r$pi,r$beta,\"Defined ratio\");xlabel<-\"Declared reduced-form first-stage slope pi\";ylabel<-\"Ratio delta/pi, binary64 approximation\";title<-\"A fixed numerator and shrinking denominator\"\n }else if(api==\"firststage\"){result<-fixed_firststage(a);summary<-list(rows=result$n,declaredInstruments=result$q,centeredRank=result$rank,classicalF=result$classicalF,HC0Wald=result$HC0Wald,twoSLS=result$twoSLS);for(r in result$rows)add(r$z[1],r$x,\"Original rows\");xlabel<-\"Proposed instrument Z0, constructed units\";ylabel<-\"Regressor X, constructed units\";title<-\"First stage; declared Gram and actual row identity\"\n }else if(api==\"ar\"){delta<-q(a$delta);pi<-q(a$pi);beta<-q(a$beta0);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));r<-ar(delta,pi,S,beta,critical);summary<-list(beta0=beta,nullMoment=r$moment,nullVariance=r$variance,statistic=r$statistic,positiveInfinity=as.integer(r$status==\"positive-infinity\"),zeroOverZero=as.integer(r$status==\"undefined-zero-over-zero\"),nonrejected=if(is.na(r$accepted))NA_real_ else as.integer(r$accepted));low<-q(a$gridLow);high<-q(a$gridHigh);grid<-lapply(0:120,function(i){b<-low+(high-low)*i/120;v<-ar(delta,pi,S,b,critical);add(b,v$statistic,\"Finite null statistic\");c(list(beta0=b),v)});result<-list(selected=r,grid=grid,scope=\"Known normal law only when stipulated with nondegenerate null variance; singular example is algebraic diagnosis, not a chi-square pivot\");xlabel<-\"Prespecified null beta0\";ylabel<-\"AR statistic, missing at undefined/infinite values\";title<-\"Null-by-null calculation; omitted plot values remain in full result\"\n }else if(api==\"fieller\"){delta<-q(a$delta);pi<-q(a$pi);critical<-q(a$criticalValue);S<-do.call(rbind,lapply(a$covariance,function(v)q(unlist(v))));result<-fieller(delta,pi,S,critical);summary<-result[c(\"A\",\"B\",\"C\",\"discriminant\",\"setType\")];summary$criticalValue<-critical;for(i in 0:120){b<--3+i/20;add(b,result$A*b*b+result$B*b+result$C,\"Approximate quadratic\")};xlabel<-\"Null coefficient beta, fixed plot viewport\";ylabel<-\"A beta^2 + B beta + C; nonpositive is accepted\";title<-\"Fieller polynomial, binary64 illustration\";zero_line<-TRUE\n }else if(api==\"overid\"){result<-fixed_overid(a);f<-result$firststage;summary<-list(beta1=result$beta1,beta2=result$beta2,J=result$J,referenceDF=result$referenceDF,testApplicable=as.integer(result$testApplicable));for(i in 0:80){b<--1+8*i/80;s<-drop(crossprod(f$centered$z,f$centered$y-b*f$centered$x));add(b,drop(crossprod(s,result$Ui%*%s)),\"Fixed-weight criterion\")};xlabel<-\"Coefficient beta under the same preliminary weight\";ylabel<-\"J(beta) finite weight criterion\";title<-\"Optimal-weight refitting; a small minimum is not validity proof\"\n }else{models<-load_actual(directory);rows<-models[[a$case]];r<-study(rows);result<-list(nativeModelRows=rows,computed=r);summary<-list(nativeModelRows=length(rows),completeRows=r$n,OLS=r$OLS,twoInstrument2SLS=r$IV,twoStepGMM=r$GMM,J=r$J,scalarZ0Ratio=r$scalar$ratio);for(v in rows)if(!anyNA(c(v$y,v$x,v$z)))add(v$x,v$y,\"Complete native rows\");xlabel<-switch(a$case,country=\"CPI inflation, annual percentage points\",person=\"Schooling years\",company=\"Starting-wage change, nominal USD/hour\");ylabel<-switch(a$case,country=\"Real GDP growth, annual percentage points\",person=\"Recorded log-wage points\",company=\"FTE change\");title<-paste0(\"Actual \",a$case,\"; common frame, proposed instruments\")}\n if(dir.exists(out))stop(\"output directory must be fresh\");dir.create(out,recursive=TRUE);display<-function(v){if(is.null(v)||!length(v)||is.na(v))return(\"undefined\");if(is.character(v))return(v);if(is.logical(v))return(if(v)\"1.000000000\"else\"0.000000000\");sprintf(\"%.9f\",v)};write.table(data.frame(metric=names(summary),value=vapply(summary,display,character(1))),file.path(out,\"summary.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");p<-do.call(rbind,points);write.table(data.frame(x=vapply(p$x,fmt,character(1)),y=vapply(p$y,fmt,character(1)),series=p$series),file.path(out,\"plot-points.csv\"),row.names=FALSE,quote=TRUE,qmethod=\"double\",sep=\",\",eol=\"\\n\");dput(result,file.path(out,\"full-result.Rtext\"));native_svg(file.path(out,\"plot.svg\"),p,xlabel,ylabel,title,zero_line);cat(paste(names(summary),vapply(summary,display,character(1)),sep=\"=\",collapse=\", \"),\"\\n\")\n}\nargs<-commandArgs(trailingOnly=TRUE)\ntryCatch(fixed_run(API,INPUT,if(length(args))args[1]else\"fixed-result\",if(length(args)>1)args[2]else\"../metr18-sources\"),error=function(e){cat(\"Rejected fixed input: \",conditionMessage(e),\"\\n\",file=stderr());quit(status=2)})\n",
        "input": {
          "case": "company"
        },
        "inputFiles": [
          {
            "file": "metr18-sources/actual90-KOR-growth-CPI-original-1980-2024.csv",
            "sha256": "cc2fb516c33bb55a7bad8849f1103ad4a1c375d9f28853cf1a6dc64f4e0334ad"
          },
          {
            "file": "metr18-sources/actual3613-NLS-original52-fields.csv",
            "sha256": "f03c12fe87497fe884212050309d09da77bd07f1b4975730fed1b53e5bb3b23f"
          },
          {
            "file": "metr18-sources/actual410-NJPA-original-codebook-fields.csv",
            "sha256": "abd533f9a11e44fe20c812cdcf8b69291ea498b3089122950854b7fbd4e77a92"
          }
        ],
        "returnCode": 0,
        "expectedFailure": false,
        "stdout": "nativeModelRows=410.000000000, completeRows=351.000000000, OLS=2.942529547, twoInstrument2SLS=4.473018188, twoStepGMM=4.391749138, J=0.009119155, scalarZ0Ratio=4.517518322 \r\n",
        "stderr": "",
        "summary": {
          "nativeModelRows": "410.000000000",
          "completeRows": "351.000000000",
          "OLS": "2.942529547",
          "twoInstrument2SLS": "4.473018188",
          "twoStepGMM": "4.391749138",
          "J": "0.009119155",
          "scalarZ0Ratio": "4.517518322"
        },
        "plotPoints": [
          {
            "x": "0.25",
            "y": "-14",
            "series": "Complete native rows"
          },
          {
            "x": "-0.75",
            "y": "11.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "-41.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "13",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-29",
            "series": "Complete native rows"
          },
          {
            "x": "-0.5",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "-0.75",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.5",
            "y": "4.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "3.25",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "-14",
            "series": "Complete native rows"
          },
          {
            "x": "-0.75",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-6.25",
            "series": "Complete native rows"
          },
          {
            "x": "-0.099999999999999645",
            "y": "-17",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.75",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-7",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "7.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.12999999999999989",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "-0.16999999999999993",
            "y": "-18",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "-5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "-0.5",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-18.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-7.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-1.75",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-20",
            "series": "Complete native rows"
          },
          {
            "x": "0.099999999999999645",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "6.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.12999999999999989",
            "y": "12",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "19",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.099999999999999645",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-12.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.65000000000000036",
            "y": "-18",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "13",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-11",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "2",
            "y": "-6",
            "series": "Complete native rows"
          },
          {
            "x": "-0.15000000000000036",
            "y": "-21.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "-1.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "19",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "22.75",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "16",
            "series": "Complete native rows"
          },
          {
            "x": "0.16000000000000014",
            "y": "-10.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.15000000000000036",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.099999999999999645",
            "y": "-3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "-0.070000000000000284",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.50999999999999979",
            "y": "-17.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.20000000000000018",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-9.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.45000000000000018",
            "y": "15.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "14.75",
            "series": "Complete native rows"
          },
          {
            "x": "-0.45000000000000018",
            "y": "0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "8.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "0.75",
            "series": "Complete native rows"
          },
          {
            "x": "-0.20000000000000018",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "-0.45000000000000018",
            "y": "-9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.28000000000000025",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.12999999999999989",
            "y": "-5.75",
            "series": "Complete native rows"
          },
          {
            "x": "-0.20000000000000018",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "-0.070000000000000284",
            "y": "-22.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "11.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-7.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "-0.57000000000000028",
            "y": "-0.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-11.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "7",
            "series": "Complete native rows"
          },
          {
            "x": "-0.049999999999999822",
            "y": "-10",
            "series": "Complete native rows"
          },
          {
            "x": "-0.20000000000000018",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "-0.45000000000000018",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "0.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.20000000000000018",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.45000000000000018",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-12.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.20000000000000018",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.10000000000000053",
            "y": "-19",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-7",
            "series": "Complete native rows"
          },
          {
            "x": "-0.0099999999999997868",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "0",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "-17.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "13.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "-0.25",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.049999999999999822",
            "y": "-24.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "9",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "0.65000000000000036",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "0.67999999999999972",
            "y": "-16",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.67999999999999972",
            "y": "5.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "0.45000000000000018",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.67999999999999972",
            "y": "11.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.59999999999999964",
            "y": "-6.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.70000000000000018",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "8.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-5.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.099999999999999645",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-7.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "8",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-0.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-13.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-20",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "18.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "10.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "10.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "8",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-13.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-26",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.64999999999999947",
            "y": "-6",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "-34",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "21.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-19",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "13.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "16",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "12",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "2.25",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "-7",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "1.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "1.1699999999999999",
            "y": "4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "24",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "1.0800000000000001",
            "y": "7.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.17999999999999972",
            "y": "-5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.75",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-7.5",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "0.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.20000000000000018",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "8",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "8.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-0.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.37999999999999989",
            "y": "-6.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.70000000000000018",
            "y": "7.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "10.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-18.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "7",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.45000000000000018",
            "y": "-3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "-8",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "7.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "6.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "10",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.70000000000000018",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.45000000000000018",
            "y": "-6.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "9",
            "series": "Complete native rows"
          },
          {
            "x": "1.0499999999999998",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "3.25",
            "series": "Complete native rows"
          },
          {
            "x": "1",
            "y": "4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0.39999999999999947",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "23.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-8.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.67999999999999972",
            "y": "6",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.17999999999999972",
            "y": "0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "14",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-2.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "28",
            "series": "Complete native rows"
          },
          {
            "x": "0.59999999999999964",
            "y": "5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "0.25",
            "y": "3",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "14.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.70000000000000018",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.66000000000000014",
            "y": "7",
            "series": "Complete native rows"
          },
          {
            "x": "0.95000000000000018",
            "y": "13.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-3",
            "series": "Complete native rows"
          },
          {
            "x": "0.62999999999999989",
            "y": "5",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "-3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "18.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "1.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-13",
            "series": "Complete native rows"
          },
          {
            "x": "0.17999999999999972",
            "y": "5.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-11.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "-3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "0.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "5.25",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "10.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.95000000000000018",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "1",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.20000000000000018",
            "y": "2.4499999999999993",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "2",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-1",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "10.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.62999999999999989",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "0.53000000000000025",
            "y": "-10",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "0.17999999999999972",
            "y": "11",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "7.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.72999999999999954",
            "y": "-5.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "0",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "4",
            "series": "Complete native rows"
          },
          {
            "x": "0.54999999999999982",
            "y": "-2",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-10",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-1.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-6",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "4.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-20",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-2.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.42999999999999972",
            "y": "3.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "9.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "14.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.5",
            "y": "7.75",
            "series": "Complete native rows"
          },
          {
            "x": "0.79999999999999982",
            "y": "-4",
            "series": "Complete native rows"
          },
          {
            "x": "0.29999999999999982",
            "y": "6.5",
            "series": "Complete native rows"
          },
          {
            "x": "0.51999999999999957",
            "y": "5.5",
            "series": "Complete native rows"
          }
        ],
        "plotFile": "metr18-fixed-results/realdata-company-r/plot.svg",
        "plotSHA256": "896b3d3cb9113c70cad69e87a93eb0a24a9f3a575b9871d12fac70f5195e90ee",
        "files": [
          {
            "file": "metr18-fixed-results/realdata-company-r/full-result.Rtext",
            "sha256": "e63e5e645fa63dfab7166c2b0493460156bce0a4e9a863391f5c3252bb305769"
          },
          {
            "file": "metr18-fixed-results/realdata-company-r/plot-points.csv",
            "sha256": "89edffee675883f9b370f986e07ae6d7065b7c3c50908ea74de04da496d6f8dd"
          },
          {
            "file": "metr18-fixed-results/realdata-company-r/plot.svg",
            "sha256": "896b3d3cb9113c70cad69e87a93eb0a24a9f3a575b9871d12fac70f5195e90ee"
          },
          {
            "file": "metr18-fixed-results/realdata-company-r/summary.csv",
            "sha256": "45853f25aaf226f467c4beed2f777e0128a30efab6a4a07de34d660063408e30"
          }
        ],
        "scope": "Actual self-contained fixed native execution. Python exact Fraction, R approximate binary64; recorded inputs are separate from current web edits. Known-normal and singular algebraic AR examples distinguished. No independent peer/native browser claim. Raw process evidence retained privately, public stderr is the actual captured rejection text without fabricated success."
      }
    }
  }
}
