StrataVariables
是诸如 CoxModelFit 的拟合函数的一个选项,指定模型应该在哪些变量上分层.
更多信息
- 分层变量(Strata variable)用于把不均匀群体划分为均匀的亚群(subgroup). 分层在比例风险模型中经常很有用,其中可能假定亚群之间的比例风险.
- StrataVariables 可能设置包括:
-
None 不将变量视为分层变量 {v1,v2,…} 将变量 vi 视为分层变量 - 在分层变量 v 下,具有 p 个层 {s1,…,sp} 的模型将输入数据根据 si 分为 p 个组.
- 在具有 pvi 个层的多个分层变量 v1, …, vk 下,输入数据被分为至多
pvi 个组,删除空亚群.
范例
基本范例 (2)
x = {{67, "Red"}, {11, "Blue"}, {32, "Blue"}, {50, "Red"}, {65, "Red"}, {44, "Red"}, {20, "Red"}, {26, "Blue"}, {69, "Red"}, {50, "Red"}, {25, "Red"}, {18, "Blue"}, {63, "Red"}, {41, "Blue"}, {30, "Blue"}, {32, "Red"}, {46, "Red"}, {35, "Blue"}, {33, "Blue"}, {22, "Blue"}};
y = EventData[{8, 22, 6, 4, 12, 11, 2, 34, 25, 15, 8, 6, 34, 6, 32, 1, 15, 9, 9, 6}, {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0}];mod = CoxModelFit[{x, y}, {a}, {a, b}, StrataVariables -> b]对于数据中的每一等级(level)创建一个层(stratum):
mod["StrataSummary"]mod["ParameterTable"]x = {{"dog", "no"}, {"dog", "no"}, {"dog", "no"}, {"dog", "no"}, {"dog", "no"}, {"dog", "yes"}, {"dog", "no"}, {"cat", "no"}, {"dog", "no"}, {"dog", "no"}, {"cat", "yes"}, {"dog", "no"}, {"dog", "no"}, {"cat", "yes"}, {"cat", "yes"}, {"dog", "no"}, {"cat", "no"}, {"dog", "yes"}, {"cat", "no"}, {"cat", "no"}, {"cat", "yes"}, {"cat", "yes"}, {"dog", "yes"}, {"dog", "no"}, {"dog", "yes"}};
y = EventData[{20, 14, 20, 92, 1, 90, 5, 11, 15, 41, 60, 4, 2, 66, 21, 3, 18, 32, 33, 36, 6, 55, 134, 7, 15}];mod = CoxModelFit[{x, y}, {}, {a, b}, StrataVariables -> {a, b}]mod["StrataSummary"]Plot[Evaluate@Table[mod["SF"][i][t], {i, Union[x]}], {t, 0, 40}, Exclusions -> None, PlotPoints -> 100]相关指南
-
▪
- 生存分析
文本
Wolfram Research (2012),StrataVariables,Wolfram 语言函数,https://reference.wolfram.com/language/ref/StrataVariables.html.
CMS
Wolfram 语言. 2012. "StrataVariables." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/StrataVariables.html.
APA
Wolfram 语言. (2012). StrataVariables. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/StrataVariables.html 年
BibTeX
@misc{reference.wolfram_2026_stratavariables, author="Wolfram Research", title="{StrataVariables}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/StrataVariables.html}", note=[Accessed: 17-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_stratavariables, organization={Wolfram Research}, title={StrataVariables}, year={2012}, url={https://reference.wolfram.com/language/ref/StrataVariables.html}, note=[Accessed: 17-November-2026]}