options ls=80; * Original Data; data orig; input cross $ genotype $ n mt1 mt2; cards; bc AaBb 162 1 -1 bc Aabb 40 0 1 bc aaBb 40 0 1 bc aabb 158 1 -1 * Some bookkeeping; proc sort;by cross; proc means noprint;by cross; var n; output sum=tot out=total; data orig; retain rcum 0; merge orig total;by cross; r=n/tot; rcum=rcum+r; * Our Bootstrap sample; data boot;set orig; do rep=1 to 100; do i=1 to tot; x=ranuni(0); if x > 0 and x <= r then output; n=1; x=x-r; end; end; proc sort;by rep cross genotype; proc means noprint;by rep cross genotype; var n mt1 mt2 tot; output sum=n smt1 smt2 stot mean=nr mt1 mt2 tot; data;set;r=n/tot; ods listing close; proc print; var rep cross genotype n mt1 mt2 tot r ; * The analysis; proc nlin nohalve sigsq=1 outest=results; by rep cross; parms theta .2; model r=.5*(mt1+mt2*theta); _weight_=n/model.r; _loss_=r*model.r*log(model.r); run; ods listing; proc print data=results;where _TYPE_='FINAL'; var rep cross theta; proc sort;by cross; * Bootstrap mean and variance; proc means;where _type_='FINAL';by cross; var theta; run;