Lets say that I have "y" that I want to model with linear regression. "x" and "z" are the things I'm interrested in showing folks, but I also have things that I want to adjust for, but not really show in my plot.
Now, I would like to show my coefficients in a plot, but I would like to keep the things I adjusted for out of it. So perhaps this could be coronary artery calcification modeled as "CAC ~ SomeBloodStuff + Bloodpressure + BMI + Smoking_status". The BMI and Smoking_status would be something that I would want to take into account, but just note that I have adjusted for them.
I gather this is how to do the model:
MyModel <- lm( CAC ~ SomeBloodstuff + BP + BMI + Smoking_status, data=MyData)
summary(MyModel)
coefficients(MyModel)
confint(MyModel, level=0.95) # Seems like a legit model.
The coefplot function in arm library gives just the sort of presentation that I want, but shows all the dimensions.
library(arm)
coefplot(MyModel)
How could I leave those few variables out of the plot while keeping them in the regression and get a plot that looks like what the coefplot produces?
Best Answer
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":
The following examples are selected from p. 8.