library(shiny)
library(htmltools)
div(class = "preface", 
    h4("Preface"),
    "Analyze the correlation of numeric variables.", br(),
    "'Correlation' calculates the correlation matrix, visualizes the correlation matrix, and helps to easily understand the relationship of variables with correlation tests and correlation plots of two variables.")


Fuction of Correlation

In the Correlation menu, correlation matrix of numerical variables and correlation test of two numerical variables are performed and a scatter plot is visualized.

Correlation Matrix

Create correlation matrix of numeric variables and visualize correlation matrix plot.

The correlation matrix function is accessed through the menu system of Descriptive Statistics > Correlation > Correlation Matrix.


Input widget for calculating correlation matrix


Basic correlation matrix output

The method of outputting the correlation matrix from the Correlation Matrix is introduced on the premise of selecting the 'diamonds' data from the Dataset: list box.

As the default setting of Descriptive Statistics > Correlation > Correlation Matrix, if you click the Execute button, the Correlation Matrix is output in the right result area.

These default settings are:

Pearson's Moment Correlation Coefficient Correlation Matrix


Correlation matrix with user selected variable

Instead of all numeric variables, the user can select a numeric variable to be output. This example selects two variables caret and table.

The settings for the correlation matrix are defined as follows.

If executed under the above conditions, the following correlation matrix is output.

correlation matrix of two variables


Correlation matrix by categorical variable

If you check the 'Calculate by category' check box, you can calculate the correlation matrix of the numeric variable for each level of the selected categorical variable.

Select the categorical variable cut from the Categorical variables: that appears by checking the Calculate by category check box as shown in the following figure.

The settings for the correlation matrix are defined as follows.

When executed under the above conditions, the following aggregate correlation matrix is output.

Correlation matrix by categorical variable


Correlation matrix with visualization

A correlation matrix is a matrix structure of statistics composed of a combination of several numeric variables. Visualizing this structure makes it easier to understand the relationship between variables.

If you check the Plot chart check box, you can output a correlation matrix plot that can identify the relationship between numeric variables.

The following is the result when the Plot chart check box is checked. A plot similar to the composition printed on the correlation matrix is output.

Correlation matrix with visualization


Correlation Test

A correlation test of two numerical variables is performed, and the relationship between the two variables is visualized based on a scatterplot.

The correlation test function is accessed through the menu system of Descriptive Statistics > Correlation > Correlation Test.


Input widget for correlation test


Basic correlation test

If you click the Execute button as the default setting of Descriptive Statistics > Correlation > Correlation Test, correlation test result will be displayed in the right result area.

These default settings are:

correlation test


Correlation test by category

If the Calculation by category check box is checked, the correlation test of two numerical variables is performed for each level of the selected categorical variable.

Select the categorical variable cut from the Categorical variables: that appears by checking the Calculate by category check box as shown in the following figure.

The settings for the correlation test were defined as follows.

If it is executed under the above conditions, the following correlation test result is output.

Correlation test by category


Correlation test with visualization

If you check the Plot chart check box, a scatter plot is output to determine the relationship between two numerical variables along with the correlation test result.

The following is the result when the Plot chart check box is checked.

Correlation test with visualization



bit2r/BitStat documentation built on Nov. 8, 2022, 4:17 p.m.