R で、調査パッケージの svytotal 関数を使用して、ある郡から他のいくつかの郡に移動する人の数の推定値と標準誤差を生成し、反対方向への移動に同じ関数を使用すると、どうすればよいでしょうか。正味の移行と対応する標準誤差を計算しますか? IPUMSデータから一方向の移行を計算する方法は次のとおりです。
mig_count_left=as.data.frame(svytotal(~nowpuma,design=subset(pums_design,left==1)))
nowpumaは、人が現在住んでいる場所の名前を持つ要素です。leftは、その人物が以前の郡を離れたと識別された場合に 1 に等しくなります。結果は次のようになります。
total SE
nowpumaAllegany & Garrett Counties 342 134.08951
nowpumaAnne Arundel County 2132 851.19956
nowpumaBaltimore County 5473 1153.62968
etc...
私は次のようなことを望んでいます:
in_out_df=merge(mig_count_left,mig_count_entered,by=row.names) #put in & out migration in a single dataframe
in_out_df$net=in_out_df$total_left-in_out_df$total_entered #compute net
in_out_df$net_SE=???? #calculate standard error for the net migration