Skip to main content

I have a N-way freqencyfrequency table generated from a regression model fit. ReproducibleThis is a reproducible example of such table:

data("CO2")
lm.fit = lm(uptake ~  Type + Treatment, data = CO2)
lm.fit$coefficients

test = count(CO2, c('Type','Treatment'))
test$res = predict(lm.fit, newdata = test)
test$freq = NULL

I am trying to visualize test as a decision tree with nodes as Type and Treatment and res as leaves. I would interpret it as the path the regression model takes, leading to the final value for a particular segment.

I am not able to generate a tree with test. I am also open to other novel ways of visulazingvisualizing these results. My original problem has many categorical variables, so I am looking for a customizable visualization, something from party::ctree or rattle::fancyRpartPlot.

I have a N-way freqency table generated from a regression model fit. Reproducible example:

data("CO2")
lm.fit = lm(uptake ~  Type + Treatment, data = CO2)
lm.fit$coefficients

test = count(CO2, c('Type','Treatment'))
test$res = predict(lm.fit, newdata = test)
test$freq = NULL

I am trying to visualize test as a decision tree with nodes as Type and Treatment and res as leaves. I would interpret it as the path the regression model takes, leading to the final value for a particular segment.

I am not able to generate a tree with test. I am also open to other novel ways of visulazing these results. My original problem has many categorical variables, so I am looking for a customizable visualization, something from party::ctree or rattle::fancyRpartPlot.

I have a N-way frequency table generated from a regression model fit. This is a reproducible example of such table:

data("CO2")
lm.fit = lm(uptake ~  Type + Treatment, data = CO2)
lm.fit$coefficients

test = count(CO2, c('Type','Treatment'))
test$res = predict(lm.fit, newdata = test)
test$freq = NULL

I am trying to visualize test as a decision tree with nodes as Type and Treatment and res as leaves. I would interpret it as the path the regression model takes, leading to the final value for a particular segment.

I am not able to generate a tree with test. I am also open to other novel ways of visualizing these results. My original problem has many categorical variables, so I am looking for a customizable visualization, something from party::ctree or rattle::fancyRpartPlot.

Source Link
Divi
  • 123
  • 4

Visualizing N-way frequency table as a Decision Tree in R

I have a N-way freqency table generated from a regression model fit. Reproducible example:

data("CO2")
lm.fit = lm(uptake ~  Type + Treatment, data = CO2)
lm.fit$coefficients

test = count(CO2, c('Type','Treatment'))
test$res = predict(lm.fit, newdata = test)
test$freq = NULL

I am trying to visualize test as a decision tree with nodes as Type and Treatment and res as leaves. I would interpret it as the path the regression model takes, leading to the final value for a particular segment.

I am not able to generate a tree with test. I am also open to other novel ways of visulazing these results. My original problem has many categorical variables, so I am looking for a customizable visualization, something from party::ctree or rattle::fancyRpartPlot.