moe_lm_param | R Documentation |
When using add_lm_line(p, show = "tb", ...)
to add to the scatter plot
p
the best fitting line and the table of fit summary (term, estimate,
standard error, tstat and pval), we can take some of the info displayed on
the plot and feed them into moe_lm_param()
to calculate the
margin of error (moe) of the slope estimate. The slope est +/- moe gives
the confidence interval. moe_lm_param()
can also be used to find the
margin of error of any parameter estimate of a multiple linear regression.
moe_lm_param(se, n, k = 1, conf_level = 0.95)
se |
Standard error of a parameter estimate. It can be read off from the table of fit summary displayed on the scatterplot. |
n |
Sample size. |
k |
Number of predictors. Default = 1 (simple linear regression). |
conf_level |
A number between 0 and 1. Default = 0.95. |
The margin of error of the a linear regression parameter estimate.
inst/examples/ex-moe_lm_param.R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.