Thursday, July 23, 2020

On to Basic Graphs

In the previous posts, I've focused on the typical commands you use to report and analyze numeric and tabular data. For the next dozen or so posts I'm going to review graphing functions.

Because now we are getting to the meat of the deal. Visualizations. I've been on a mission to understand how to interpret graphs for many years -- it's why I stepped up to study stats in 2018. The reasons why people need to understand what graphs tell us are broadcast by anyone who knows anything about statistics. To our detriment, until we look into it more deeply we simply nod and ignore. 

I imagine that most of what people can be made to understand can be done using one or more of the graphs in this section.

Wednesday, July 22, 2020

colPercents

With colPercents you can get row, column, and total percents for a contingency table (the marginal values I write about in the table topic).

The colPercents command is part of the RcmdrMisc package that I installed as part of STAT 3743. From the R community, it looks like you can get the same value using prop.table and cbind, though that's a multi-step process.

Just two parameters, the table of frequency counts, and optional digits for % display.

R Example


This example uses the carData package Mroz data, which contains labor force participation for married women. This example shows labor force participation (lfp) against whether the wife attended college (wfc).

> colPercents(xtabs(~ lfp + wc, data=Mroz))
wc
lfp       no   yes
  no     47.5  32.1
  yes    52.5  67.9
  Total 100.0 100.0
  Count 541.0 212.0



This table reports that 47.5% of married women who did not attend college do not work.