我有来自多个(22?)样本的数据,这些样本的样本量差异很大。我知道样本越大,参数估计得越好,但这不是我想在这里解决的问题。我想绘制分布图和估计参数,就好像样本量在各个组/样本之间没有差异一样。这意味着大样本需要降低权重,小样本需要增加权重。
我尝试在“用 X 拟合 Y”中执行此操作,如下所示:我计算了一个新变量 WEIGHT,即组的样本量除以总样本量。假设我有四个组:
第 1 组:N1=100
第 2 组:N1=500
第 3 组:N1=200
第 4 组:N1=400
第 1 组和第 2 组属于第 1 类,第 3 组和第 4 组属于第 2 类
重量为:
第 1 组:100/1200
第 2 组:500/1200
第 3 组:200/1200
第四组:400/1200
如果我执行“用 X 拟合 Y”,其中 Y 是 DV,X 是“类型”,并且用 WEIGHT 计算权重,然后使用“比较密度”来获得重叠密度的图,它看起来是正确的。但是,如果我继续并得到 DV 的标准偏差,这些偏差比任何组的标准偏差都大得多。这让我觉得我没有理解我在做什么。
帮助?
我认为这篇文章可以帮助你:
已解决:加权标准差 - JMP 用户社区
可能以下脚本有助于理解会发生什么。
因此,无论您采用何种方法(角色权重或频率),在平均工作量的计算方法中。
与你的相比,我对重量的定义不同,我希望重量的总和为 1200(你有 4*1200)。
这应该无关紧要,对于频率作用中的权重而言,它并不重要,但对于角色权重中的权重而言,它确实如此。 见脚本。
不幸的是,我无法准确解释为什么与总平均值相比,小数据集的标准偏差非常大。 这可能是由于平方和根...
我个人不会使用您的方法,因为不清楚发生了什么。 我会做组总结,然后是每个组的平均值,每个权重为 1。 然后将该结果组合到您的图表中。
Names Default To Here( 1 );
// about the role of weight and frequency for calculation of mean and stddev
//
// web("https://www.jmp.com/support/help/en/16.1/?os=win&source=application&utm_source=helpmenu&utm_medium=application#page/jmp/summary-statistics.shtml");
//
nelem_lst = {100, 500, 200, 400};
table_lst = {};
For Each( {value, index}, nelem_lst,
Eval(
Eval Expr(
table_lst[index] = New Table( "Table " || Char( index ),
add rows( nelem_lst[index] ),
New Column( "Group", "Character", set each value( "Group " || Char( index ) ) ),
New Column( "Type", "Character", set each value( If( index <= 2, "Type 1", "Type 2" ) ) ),
New Column( "DV", "Continuous", formula( Random Normal( Expr( Mod( index, 2 ) ), Expr( Mod( index, 2 ) + 1 ) ) ) )
)
)
);
Wait( 0.1 );
table_lst[index]:DV << delete formula;
);
Wait( 0 );
dt = table_lst[1] << concatenate( Table Name( "All" ), table_lst[2 :: 4] );
For Each( {value}, table_lst, Close( value, "NoSave" ) );
Summarize( dt, group_lst = by( :group ) );
ngroups = N Items( group_lst );
dt << New Column( "ColMean[Group]", formula( Col Mean( :DV, :group ) ) );
dt << New Column( "ColStd[Group]", formula( Col Std Dev( :DV, :group ) ) );
Eval( Eval Expr( dt << New Column( "weight[Group]", formula( Col Number( :DV ) / Expr( ngroups ) / Col Number( :DV, :group ) ) ) ) );
nw = New Window( "oneway comparison",
H List Box(
Panel Box( "w/o weight",
dt << Oneway( Y( :DV ), X( :Group ), Means and Std Dev( 1 ), Mean Error Bars( 1 ), Std Dev Lines( 1 ) );
),
Panel Box( "weight in role frequency",
dt << dt << Oneway(
Y( :DV ),
X( :Group ),
Freq( :"weight[Group]"n ),
Means and Std Dev( 1 ),
Mean Error Bars( 1 ),
Std Dev Lines( 1 )
);
),
Panel Box( "weight in role weight",
dt << dt << Oneway(
Y( :DV ),
X( :Group ),
Weight( :"weight[Group]"n ),
Means and Std Dev( 1 ),
Mean Error Bars( 1 ),
Std Dev Lines( 1 )
);
)
)
);
nw = New Window( "Tabulate comparison",
H List Box(
Panel Box( "w/o weight",
dt << Tabulate(
Change Item Label( Grouping Columns( :Type( "All" ), "All" ) ),
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N ) ),
Column Table( Analysis Columns( :"weight[Group]"n ), Statistics( Sum ) ),
Column Table( Analysis Columns( :DV ), Statistics( Mean ) ),
Column Table( Statistics( Std Dev ), Analysis Columns( :DV ) ),
Row Table( Grouping Columns( :Type, :Group ), Add Aggregate Statistics( :Type, :Group ) )
)
)
),
Panel Box( "weight in role frequency",
dt << Tabulate(
Change Item Label( Grouping Columns( :Type( "All" ), "All" ) ),
Freq( :"weight[Group]"n ),
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N ) ),
Column Table( Analysis Columns( :"weight[Group]"n ), Statistics( Sum ) ),
Column Table( Analysis Columns( :DV ), Statistics( Mean ) ),
Column Table( Statistics( Std Dev ), Analysis Columns( :DV ) ),
Row Table( Grouping Columns( :Type, :Group ), Add Aggregate Statistics( :Type, :Group ) )
)
)
),
Panel Box( "weight in role weight",
dt << Tabulate(
Change Item Label( Grouping Columns( :Type( "All" ), "All" ) ),
weight( :"weight[Group]"n ),
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N ) ),
Column Table( Analysis Columns( :"weight[Group]"n ), Statistics( Sum ) ),
Column Table( Analysis Columns( :DV ), Statistics( Mean ) ),
Column Table( Statistics( Std Dev ), Analysis Columns( :DV ) ),
Row Table( Grouping Columns( :Type, :Group ), Add Aggregate Statistics( :Type, :Group ) )
)
)
)
)
);
dt << Summary( Group( :Group, :Type, :"ColMean[Group]"n, :"ColStd[Group]"n, :"weight[Group]"n ), Freq( "None" ), Weight( "None" ) );我在我的原始帖子中犯了一个错误,如果我知道如何删除,我会删除它。 正确版本如下:
我有几个(22 个?)样本的数据,样本大小差异很大。 我知道使用更大的样本可以更好地估计参数,但这不是我想在这里解决的问题。 这是我想要图形分布和估计参数,就好像样本大小在组/样本之间没有差异一样。 这意味着需要对大样本进行去加权,对小样本进行加权。
我尝试在“用 X 拟合 Y”中执行此操作,如下所示:我计算了一个新变量 WEIGHT,作为该组的样本大小除以总样本大小。 所以假设我有四个组:
第一组:N1=100
第 2 组:N1=500
第 3 组:N1=200
第 4 组:N1=400
此外,第 1 组和第 2 组是第 1 类,第 3 组和第 4 组是第 2 类
重量将是:
第 1 组:1200/100
第 2 组:1200/500
第 3 组:1200/200
第 4 组:1200/400
如果我执行“用 X 拟合 Y”,其中 Y 是 DV,X 是“类型”,重量按重量计算,然后使用“比较密度”得到重叠密度图,它看起来是正确的。 但是,如果我继续并获得 DV 的标准差,这些将比任何组的标准差大得多。 这让我觉得我不明白我在做什么。
帮助?