Description Usage Arguments Examples
This function takes the linear regression model you estimate with lm() for your final projects and returns a coefficient plot appropriate for you to use in your poster or final paper.
1 2 3 |
model |
Model takes the object name of your linear regression model. Example - if you run the following command: m1 <- lm(y~x), then enter m1 for this argument. |
var.labels |
New variable names for the plot to be entered as characters here. Note, this must be the same length as the variables in your model. If you have four variables, you must enter four names. See example code below. |
grid |
Include vertical grid lines in the plot. Default is True. |
grid.int |
Spacing interval for grid lines. Default value is 5. |
mai |
Change plot margins (inches). |
ps |
Change text size in plot. This will be useful for your posters (30 would be good for a poster, 12 for a paper). |
pt.type |
Point style of regression parameter point estimate. Default is 16, circle. See ?points for information on different styles. |
pt.size |
Side of point estimate, default is 1. |
pt.color |
Color of point estimate, default is 'black', Any color argument will work here. |
lwd |
Line width for confidence intervals, default is 1. |
lty |
Line type for confidence intervals, default is 2 (dashed line). See the lty argument in ?par for additional details on line types. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Estimate a regression using 'mtcars' data:
m <- lm(mpg~disp+hp+wt,data=mtcars)
confidence(m)
# Plot without intercept:
confidence(m,vars=c('disp','hp','wt'))
# Plot with intercept and one covariate:
confidence(m,vars=c('(Intercept)','wt'))
# Plot with two model variables AND new variable names:
confidence(m,vars=c('disp','wt'),var.labels=c('Displacement','Weight'))
# Plot with higher confidence interval and legend:
confidence(m,level=0.99,legend=TRUE)
# Dynamic margins for longer variable names:
confidence(m, vars=c('hp','wt'),var.labels=c('A really long name for variable: Horse Power','Weight'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.