Skip to main content
deleted 52 characters in body
Source Link
rolando2
  • 12.9k
  • 1
  • 44
  • 66

You can do what you're looking to do if you make fuller use of the coefplot package's optional arguments. In documentation, three relevant arguments are "predictors," "coefficients," and "strict":

predictors - A character vector specifying which variables to keep. Each individual variable has to be specfied [sic], so individual levels of factors must be specified. We are working on making this easier to implement, but this is the only option for now.

coefficients - A character vector specifying which factor variables to keep. It will keep all levels and any interactions, even if those are not listed.

strict - If TRUE then predictors will only be matched to its own coefficients, not its interactions [sic]

The following examples are selected from p. 8.

data(diamonds)

head(diamonds)

model1 <- lm(price ~ carat + cut*color, data=diamonds)

model2 <- lm(price ~ carat*color, data=diamonds)

model3 <- glm(price > 10000 ~ carat*color, data=diamonds)

coefplot(model1, predictors="color")

coefplot(model1, predictors="color", strict=TRUE)

coefplot(model1, coefficients=c("(Intercept)", "color.Q"))

coefplot(model1, predictors="cut", coefficients=c("(Intercept)", "color.Q"), strict=TRUE)

You can do what you're looking to do if you make fuller use of the coefplot package's optional arguments. In documentation, three relevant arguments are "predictors," "coefficients," and "strict":

predictors - A character vector specifying which variables to keep. Each individual variable has to be specfied [sic], so individual levels of factors must be specified. We are working on making this easier to implement, but this is the only option for now.

coefficients - A character vector specifying which factor variables to keep. It will keep all levels and any interactions, even if those are not listed.

strict - If TRUE then predictors will only be matched to its own coefficients, not its interactions [sic]

The following examples are selected from p. 8.

data(diamonds)

head(diamonds)

model1 <- lm(price ~ carat + cut*color, data=diamonds)

model2 <- lm(price ~ carat*color, data=diamonds)

model3 <- glm(price > 10000 ~ carat*color, data=diamonds)

coefplot(model1, predictors="color")

coefplot(model1, predictors="color", strict=TRUE)

coefplot(model1, coefficients=c("(Intercept)", "color.Q"))

coefplot(model1, predictors="cut", coefficients=c("(Intercept)", "color.Q"), strict=TRUE)

You can do what you're looking to do if you make fuller use of the coefplot package's optional arguments. In documentation, three relevant arguments are "predictors," "coefficients," and "strict":

predictors - A character vector specifying which variables to keep. Each individual variable has to be specfied [sic], so individual levels of factors must be specified. We are working on making this easier to implement, but this is the only option for now.

coefficients - A character vector specifying which factor variables to keep. It will keep all levels and any interactions, even if those are not listed.

strict - If TRUE then predictors will only be matched to its own coefficients, not its interactions [sic]

The following examples are selected from p. 8.

model1 <- lm(price ~ carat + cut*color, data=diamonds)

model2 <- lm(price ~ carat*color, data=diamonds)

model3 <- glm(price > 10000 ~ carat*color, data=diamonds)

coefplot(model1, predictors="color")

coefplot(model1, predictors="color", strict=TRUE)

coefplot(model1, coefficients=c("(Intercept)", "color.Q"))

coefplot(model1, predictors="cut", coefficients=c("(Intercept)", "color.Q"), strict=TRUE)
Source Link
rolando2
  • 12.9k
  • 1
  • 44
  • 66

You can do what you're looking to do if you make fuller use of the coefplot package's optional arguments. In documentation, three relevant arguments are "predictors," "coefficients," and "strict":

predictors - A character vector specifying which variables to keep. Each individual variable has to be specfied [sic], so individual levels of factors must be specified. We are working on making this easier to implement, but this is the only option for now.

coefficients - A character vector specifying which factor variables to keep. It will keep all levels and any interactions, even if those are not listed.

strict - If TRUE then predictors will only be matched to its own coefficients, not its interactions [sic]

The following examples are selected from p. 8.

data(diamonds)

head(diamonds)

model1 <- lm(price ~ carat + cut*color, data=diamonds)

model2 <- lm(price ~ carat*color, data=diamonds)

model3 <- glm(price > 10000 ~ carat*color, data=diamonds)

coefplot(model1, predictors="color")

coefplot(model1, predictors="color", strict=TRUE)

coefplot(model1, coefficients=c("(Intercept)", "color.Q"))

coefplot(model1, predictors="cut", coefficients=c("(Intercept)", "color.Q"), strict=TRUE)