Confidentiality Vetting Support: Rounding proportions using Rounder – An R Shiny App

Release date: April 27, 2022

Confidentiality Vetting Support: Rounding proportions using Rounder – An R Shiny App

(The Statistics Canada symbol and Canada wordmark appear on screen with the title: "Confidentiality Vetting Support: Rounding proportions using Rounder – An R Shiny App")

Welcome to Statistic Canada's data access training series. This video is part of the confidentiality vetting support series and presents examples of how to use different statistical software packages to perform the analyses required for researchers working with confidential data. The code that supports the Rounder App is available. Please ask your analyst if you're not sure where to find it. In this video, I'll be using a public use microdata access file to demonstrate the different features of the rounder tool. The rounder app will be useful for those who need rounded values, weighted values, randomized counts and to check if counts reach the minimum cell size. Before demonstrating the app, we will set up the tool in our folders and in R. Step 1 is locating and extracting the Rounder App package which can be placed in the same directory as the zipped folder documents, "in this case. After it extracts, we'll go into the folder and open up the R file called Rounder App. Now we need to change the path so it can find the required files. So back "in the file explorer, we right click the extracted folder and select copy as path which we paste "in the path object in between quotations, making sure to change backslashes to forward "slashes, and getting rid of the Rounder App portion of the path because that is included in the libpaths function right below. Finally highlight and run all the code and the app "will open. This is the Rounder App. It is the front end "of the vetter package for R studio. Rounder is a point and click interactive tool for preparing supporting documents for proportions counts and means. This R Shiny app can be used to generate both weighted and unweighted counts and conduct random rounding. In this video, I will show you how it works. Right now, I have the app open in my browser, but it works completely offline. The first thing we're going to do is import a data file. The supported types include stata, spss, sas and csv. We'll be using GSS which is the general social survey public use file. We can load the whole thing, but in order to save time, we highly recommend only selecting the variables you need. For this example I'll be using Canadian birthplace, the purchase of takeout dishes, family income, and age of the respondent's father and then we'll hit go. Here, we see a summary of our data, which means it is successfully loaded. For all the functions, we're going to go over here. For check proportions, we're going to put in two variables and we'll go through some of these columns. So first, we'll see our two variables and then, we'll see a warning column here. Now this warning will show up if your numerator is below your minimum cell size requirement or if the difference between your numerator and denominator is below that same requirement. And this is very useful, because it can be "tailored to the specific vetting rules for the different surveys. Here we see the randomized rounding as well as the seed. Here we see the numerator, the rounded numerator, the difference between those two, the denominator, the rounded denominator and the difference between those two. And if I scroll... we have the proportion and the rounded proportion, which will be useful for researchers to see. And now, up here, we have many parameters we can edit. For the weights, we can add our weight. And now we will see a new column being added that has our unweighted values as well as our weighted values, including the weighted proportions. Here we can switch between conventional and random rounding as well as change the seed. Here we can tailor our minimum cell size requirement to fit our vetting rule and we'll see that if we lower it, our warning will go away, because now there are enough respondents in our category to fit this. And if we put it back to 5, we'll see it come back. Here we can change our rounding base and this will affect our rounded outputs. We can change how many digits should show up in each value. And we can keep our missing values or we can delete the missing values and then our proportions will change accordingly. The next features are available for all the tabs and it's export displayed in which you can copy what's shown in the table to your clipboard or you can download complete outputs which will include even the sections that aren't shown on the table at the moment, and it'll give you the option to save the file. This is what the file looks like once you open it, and we'll see that it's a nicely formatted table with all our columns and the warning we had previously. Next we have check counts, which is very similar to check proportions. It'll basically give us the count of each category as well as the rounded count that we can change and we'll see our data in the table here. Check continuous will allow us to check our continuous variables. So let's assume that we're putting in a continuous variable and then it'll give us our total n, our missing n, our valid n, so that's total minus the missing, and our rounded valid n, which is determined from the rounding base here. The parameters up here are similar to what we had in the previous sections and the last feature is random round, which is great for model sample sizes. We can enter some values here, and then when we hit random round, we'll see that we get our rounded values here, as well as the difference between our rounded values and the actual value. Here we have the generated seed for the random round and if you want to reproduce your results you, can manually enter the seed. This was just a quick demonstration of the Rounder app and we hope it makes the vetting process a little bit easier. Thank you for watching and have a wonderful day.

(Canada wordmark appears.)

Date modified: