Yet one more of the graphical ways of showing data with error bars for different groups.
A dot.chart with error bars for different groups or variables is found using from describe
, describeBy
, statsBy
or data from bestScales
.
error.dots(x=NULL, var = NULL, se = NULL, group = NULL, sd = FALSE, effect=NULL
,stats=NULL, head = 12, tail = 12, sort = TRUE, decreasing = TRUE, main = NULL,
alpha = 0.05, eyes = FALSE, min.n = NULL, max.labels = 40, labels = NULL, groups = NULL,
gdata = NULL, cex = par("cex"), pt.cex = cex, pch = 21, gpch = 21, bg = par("bg"),
color = par("fg"), gcolor = par("fg"), lcolor = "gray", xlab = NULL, ylab = NULL,
xlim = NULL,add=FALSE,order=NULL, ...)
A data frame or matrix of raw data, or the resulting object from describe
, describeBy
, statsBy
or bestScales
The variable to show (particularly if doing describeBy or StatsBy plots).
Source of a standard error
A grouping variable, if desired. Will group the data on group for one variable (var)
if FALSE, confidence intervals in terms of standard errors, otherwise draw one standard deviation
Should the data be compared to a specified group (with mean set to 0) in effect size units?
A matrix of means and se to use instead of finding them from the data
The number of largest values to report
The number of smallest values to report
Sort the groups/variables by value
Should they be sorted in increasing or decreasing order (from top to bottom)
The caption for the figure
p value for confidence intervals
Draw catseyes for error limits
If using describeBy or statsBy, what should be the minimum sample size to draw
Length of labels (truncate after this value)
Specify the labels versus find them from the row names
ignored
ignored
The standard meaning of cex for graphics
ignored
Plot character
ignored
background color
Color
ignored
ignored?
Label the x axis, if NULL, the variable name is used
If NULL, then the group rownames are used
If NULL, then calculated to show nice values
If TRUE, will add the plot to a previous plot (e.g., from dotchart)
if sort=TRUE, if order is NULL, sort on values, otherwise, if order is returned from a previous figure, use that order.
And any other graphic parameters we have forgotten
Returns (invisibily) either a describeBy or describe object as well as the order if sorted
Adapted from the dot.chart function to include error bars and to use the output ofdescribe
, describeBy
, statsBy
, fa
and bestScales
.
To speed up multiple plots, the function can work from the output of a previous run. Thus describeBy will be done and the results can be show for multiple variables.
If using the add=TRUE option to add an error.dots plot to a dotplot, note that the order of variables in dot plots goes from last to first (highest y value is actually the last value in a vector.) Also note that the xlim parameter should be set to make sure the plots line up correctly.
Used in particular for showing https://sapa-project.org output.
describe
, describeBy
, or statsBy
as well as error.bars
, error.bars.by
, statsBy
or bestScales
.
# NOT RUN {
temp <- error.dots(psychTools::bfi[1:25],sort=TRUE,
xlab="Mean score for the item, sorted by difficulty")
error.dots(psychTools::bfi[1:25],sort=TRUE, order=temp$order,
add=TRUE, eyes=TRUE) #over plot with eyes
error.dots(psychTools::ability,eyes=TRUE, xlab="Mean score for the item")
# }
Run the code above in your browser using DataLab