laomm002 发表于 2010-10-25 19:24 
bobguy 发表于 2010-10-25 04:34 
laomm002 发表于 2010-10-24 20:54 
问题如下:
已知血型的比例结构为
O型:q^2
A型:p^2+2pq
B型:r^2+2qr
AB型:2pr
其中q+p+r=1,p>0,q>0,r>0
现在任意调查了1000人,发现其中O型374人,A型436人,B型132人,AB型58人
在显著水平为0.05条件下,调查数据与理论比例是否相符?
请各位高手帮忙看一下这道题目怎么做,谢谢
Pa =: prob of A型
Pb =: prob of B型
Pab =: prob of AB型
Since q+p+r=1,p>0,q>0,r>0, then (q+p+r) ** =1  => Po, Pa, Pb, Pab is a multinomial distribution.
The estimates,
P(i) = N(i)/N          i= o, a, b, ab,  N(.) is the number in each type, N is the total number
var (P(i) )= P(i) * (1-P(i)) /N
Use types of O型374人,A型436人,B型132人 to estimate Po, Pa, Pb and their variance
Use the last one AB型58人 to do the checking/testing.
不过我不太清楚如何构造检验用的统计量,以及该统计量的分布如何
如果能详细讲解一下最好
可以贴到http://www.pinggu.org/bbs/thread-943862-1-1.html
在那里我设置了奖励
Here is the solution in SAS based on likelihood estimation. You may refer to SAS/Stats/Proc nlmixed for further directions. From estimates you can solve for p q r if wanted.
data t1;
   n1=374 ; n2=436; n3=132; n4=58;
   Size=sum(n1,n2,n3,n4);
   do n=1 to Size;
      if n<=n1 then Type=1;
   else if n<=n1+n2 then Type=2;
   else if n<=n1+n2+n3 then Type=3;
   else  Type=4;
      output;
 end;
run;
proc nlmixed data=t1;
parms Po=0.3 Pa=0.4 Pb=0.1;* Pab=0.058;
bounds 0<Po Pa Pb < 1;
if type=1 then p=Po;
else if type=2 then p=Pa;
else if type=3 then p=Pb;
else  p=1-po-pa-pb;
P=MAX(1E-12,MIN(P,0.99999999));
loglik=log(p);
estimate 'test' 1-(Po+Pa+Pb) df=3;
model size ~ general(loglik);
run;
*************************results*****************************;
                                      The NLMIXED Procedure
                                          Specifications
                 Data Set                                    WORK.T1
                 Dependent Variable                          Size
                 Distribution for Dependent Variable         General
                 Optimization Technique                      Dual Quasi-Newton
                 Integration Method                          None
                                            Dimensions
                             Observations Used                   1000
                             Observations Not Used                  0
                             Total Observations                  1000
                             Parameters                             3
                                            Parameters
                                Po          Pa          Pb    NegLogLike
                               0.3         0.4         0.1    1247.07722
                                         Iteration History
                 Iter     Calls    NegLogLike        Diff     MaxGrad       Slope
                    1         8    1170.80887    76.26835     461.134    -26161.1
                    2        11    1167.34289     3.46598     418.437    -639.639
                    3        13    1165.42142    1.921472    289.1771    -25.3955
                    4        14    1163.08601    2.335409    149.2346    -44.5881
                    5        15    1162.39915    0.686859    81.52841    -2.60364
                    6        17    1162.19791    0.201246    8.970628     -0.3725
                    7        19    1162.19606    0.001848    0.284705    -0.00372
                    8        21    1162.19604    0.000015    0.013426    -0.00003
                    9        23    1162.19604    4.725E-9    0.000062    -9.47E-9
                           NOTE: GCONV convergence criterion satisfied.
                                          Fit Statistics
                             -2 Log Likelihood                 2324.4
                             AIC (smaller is better)           2330.4
                             AICC (smaller is better)          2330.4
                             BIC (smaller is better)           2345.1
                                          The SAS System       10:10 Tuesday, October 26, 2010 292
                                      The NLMIXED Procedure
                                       Parameter Estimates
                        Standard
   Parameter  Estimate     Error    DF  t Value  Pr > |t|   Alpha     Lower     Upper  Gradient
   Po           0.3740   0.01530  1000    24.44    <.0001    0.05    0.3440    0.4040  0.000024
   Pa           0.4360   0.01568  1000    27.80    <.0001    0.05    0.4052    0.4668  0.000062
   Pb           0.1320   0.01070  1000    12.33    <.0001    0.05    0.1110    0.1530  0.000055
                                       Additional Estimates
                       Standard
  Label    Estimate       Error      DF    t Value    Pr > |t|     Alpha       Lower       Upper
  test      0.05800    0.007392       3       7.85      0.0043      0.05     0.03448     0.08152