gpt4 book ai didi

Type 3 Anova on parsnip models(帕斯尼普模型的3型方差分析)

转载 作者:bug小助手 更新时间:2023-10-25 17:12:10 25 4
gpt4 key购买 nike



Lets say I create an lm model with 2 predictors at least one which is categorical and there is also an interaction term involved. Now I would like to also get the significance level for the overall interaction term. for this I would simply use a type 3 Anova
in this example I want to get the significance level for Petal.Length:Species

假设我创建了一个带有2个预测值的lm模型,其中至少有一个预测值是绝对的,并且还包含一个交互作用项。现在,我还想获得总体交互术语的重要级别。为此,我将简单地使用类型3方差在此示例中,我希望获得花瓣的显著水平。长度:物种


lm(Sepal.Length ~ Petal.Length + Species + Petal.Length:Species, data = iris) %>% 
car::Anova(type = 3)

However, this approach doesn't seem to work for parsnip models:

然而,这种方法似乎不适用于ParSnip模型:


rec <- 
recipe(Sepal.Length ~ Petal.Length + Species, data = iris) %>%
step_interact(terms = ~ Species:Petal.Length)

lm_spec <-
linear_reg() %>%
set_engine("lm")

wf_2p_int <-
workflow() %>%
add_recipe(rec) %>%
add_model(lm_spec) %>%
fit(iris)

wf_2p_int %>%
extract_fit_engine() %>%
car::Anova(type = 3)

Is there any straight-forward way to get the same results for models created via the tidymodels approach?

对于通过tidyModels方法创建的模型,有没有什么直接的方法可以获得相同的结果?


更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com