Learn R Programming

DFA.CANCOR (version 0.4.3)

GROUP.PROFILES: Group Profile Plots

Description

Produces profile plots of group means for one or more continuous outcome variables.

Usage

GROUP.PROFILES(data, groups, variables,  
        plot_type ='bar', bar_type = 'all',
        rescale='standardize',
        CI_level= 95, ylim=NULL,
        plot_save = FALSE, plot_save_type = 'png', plot_title = NULL,
        cols_user = NULL,
        verbose=TRUE)

Value

If verbose = TRUE, the displayed output includes the means, standard deviations, Ns, and confidence intervals for the groups on the variables.

Arguments

data

A dataframe where the rows are cases and the columns are the variables.

groups

The name of the groups variable in data, e.g., groups = 'Group'.

variables

The name of the dependent (outcome) variable(s) in data, e.g., variables = c('esteem','anxiety').

plot_type

The options are 'bar' for bar plot, or 'profile' for a lines profile plot.

bar_type

When plot_type = 'bar', the options for bar_type are 'all', for placing the bar plots for all variables in one plot, or 'separate', for placing the bar plots for the variables in separate plots.

rescale

(optional) Should the variables be rescaled into a common metric? The options are 'no' (the default), or 'standardize'.

CI_level

(optional) The confidence interval for the input, if provided (in whole numbers). The default is 95.

ylim

(optional) Limits for the y-axis, e.g., ylim = c(0, 5). Not implemented when multiple bar plots are requested.

plot_save

Should a plot be saved to disk? TRUE or FALSE (the default).

plot_save_type

The output format if plot_save = TRUE. The options are 'bitmap', 'tiff', 'png' (the default), 'jpeg', and 'bmp'.

plot_title

(optional) A title for the plot.
Example: title = 'Group Profiles'

cols_user

A vector of colours for the groups.
If NULL, the default colours are selected, in order, from this vector: cols_user <- c('blue', 'red', 'cyan2', 'darkviolet', 'chartreuse1', 'yellow', 'burlywood3','darkseagreen1', 'mediumvioletred', 'darkgreen','bisque','cyan3', 'deeppink4').

verbose

(optional) Should detailed results be displayed in console?
The options are: TRUE (default) or FALSE.

Author

Brian P. O'Connor

Details

The continuous 'variables' can be rescaled (standardized) into the same metric to facilitate interpretation when the variables that are in different metrics are placed on one plot.

When plot_type = 'bar' and bar_type = 'separate', a maximum of four plots will be produced, for the first four 'variables'.

Examples

Run this code
GROUP.PROFILES(data = data_DFA$Ho_2014,
               groups = 'group_1_fac',
               variables = c("fast_ris", "disresp", "sen_seek", "danger"),
               rescale= 'data', 
               plot_type ='bar', 
               bar_type = 'separate')
# \donttest{
#first run DFA
DFA_output <- DFA(data = data_DFA$Field_2012, 
                  groups = 'Group', 
                  variables = c('Actions','Thoughts'),
                  predictive = TRUE, 
                  priorprob = 'EQUAL',   
                  covmat_type='separate',
                  verbose = TRUE)

# then produce a profile plot of the group centroids on the discriminant functions
GROUP.PROFILES(data = DFA_output$dfa_scores,
               groups = 'group',
               variables = c('Function.1','Function.2'),
               rescale= 'no',
               plot_type ='profile',
               bar_type = 'separate')
# }

Run the code above in your browser using DataLab