


Scatterplot matrix code#
# Acquire specific r code for the rmat() functionĬol <- colorRampPalette(c("black", "white", "red"))(20)Ĭormat <- rmat(Poverty_corr_matrix, type = "full", col=col) Poverty_corr_matrix <- as.matrix(Poverty_Data_Cleaned) # Remove the non-numeric columns from the poverty data file A matrix of Pearson’s r values for the dependent and independent variables. On the other hand, the percent of individuals with no health insurance has a rather low Pearson’s r value of 0.29 indicating a rather weak positive correlation. From Table 5.2 we see that the percent of families below the poverty line and median household income have a Pearson’s r value of -0.76, which suggests a rather strong negative linear correlation. Values of r closer to -1.0 or +1.0 indicate a stronger linear relationship (correlation). Values of Pearson’s r range from -1.0 (perfectly negatively correlated) to +1.0 (perfectly positively correlated). Elsewhere in the matrix, note that the “-“ sign indicates a negative correlation, while the absence of a “-“ sign indicates a positive correlation. This means that each variable is perfectly correlated with itself. From Figure 5.8, we can see that the main diagonal of the matrix is 1.00. One of the more common is the Pearson product moment (or Pearson’s r), which is used in Chunk 7 of RMarkdown. There are several measures of correlation that are available. By examining the scatterplot matrix, it is possible to see the relationships between the different variables.Īfter examining the scatterplot matrix and getting a visual sense of the variables and their relationships, we can derive a quantitative measure of the strength and direction of the correlation. This relationship illustrates a negative correlation (e.g., as one variable increases, the other variable decreases). Continuing reading to the right, we see that as the median household income increases, then the percent of families below the poverty line decreases.

This relationship suggests a positive correlation (the variables both change in the same direction). The scatter of points suggests that as the percent of people without health insurance increases, the percent of families below the poverty line also increases. In this case, the percent of families below the poverty line is the dependent variable (y) and the percent without health insurance is the independent variable (x). Reading to the right, we see a scatter of points that relates to the correlation of percent of families below the poverty line with the percent of families without health insurance. In the upper left box, the percent of families below the poverty line appears. The labels in the main diagonal report the variables. Pairs(~Poverty_Data_Cleaned$PctFamsPov+Poverty_Data_Cleaned$PctNoHealth+Poverty_Data_Cleaned$MedHHIncom+Poverty_Data_Cleaned$PCTUnemp, main = "Scatterplot of Ohio Poverty Data", lwd=2, labels = c("% Poverty", "% No Health Insurance", "Median Household Income", "% Unemployed"), pch=19, cex = 0.75, col = "blue")įigure 5.8 shows a scatterplot matrix of the variables selected for this regression analysis. In its simplest form, a scatterplot graphically shows how changes in one variable relate to the changes in another variable. To begin to visualize that linear relationship, we will start with an examination of a scatterplot matrix showing the variables in the sixth chunk of RMarkdown. = doRunConvert(.An underlying idea of regression analysis is that the variables are linearly related. = doRun(javaRichDocument, source) Įrror in mwtools.liveCodeToDocbook (line 164) LiveEditorUtilities.execute(editorId, source) Įrror in mwtools.liveCodeToDocbook>doRunConvert (line 346) UncaughtErrorEvent_RequestIdAdapter: Įrror in .packageEachOutputĮrror in .packageOutputsĮrror in .outputStreamEventĮrror in in /notifyFlushOutputsĮrror in /streamOutputsCallbackĮrror in /postRegionCallbackĮrror in in Įrror in .evalRegionsĮrror in .execute (line 68)īuiltin('_liveCodeExecutionPortal', '.evalRegions', editorId, uuid, regionDataList, fullFileText, false, true, fileName, -1) Įrror in mwtools.liveCodeToDocbook>doRun (line 431) Unexpected type in OutputPackager.packageOneOutput: UncaughtError. Warning: Error occurred while executing the listener callback for event POST_REGION defined for class :Įrror using .packageOneOutput
