Posts Tagged ‘ Tutorials ’

Ready Made Plots make Work Easier

May 16, 2018
By
Ready Made Plots make Work Easier

A while back Simon Jackson and Kara Woo shared some great ideas and graphs on grouped bar charts and density plots (link). Win-Vector LLC‘s Nina Zumel just added a graph of this type to the development version of WVPlots. Nina has, as usual, some great documentation here. More and more I am finding when you … Continue reading Ready Made Plots make Work Easier

Read more »

A macro to execute PROC TTEST for multiple binary grouping variables in SAS (and sorting t-test statistics by their absolute values)

In SAS, you can perform PROC TTEST for multiple numeric variables in the same procedure.  Here is an example using the built-in data set SASHELP.BASEBALL; I will compare the number of at-bats and number of walks between the American League and the National League. proc ttest data = sashelp.baseball; class League; var nAtBat nBB; ods […]

Read more »

A macro to automate the creation of indicator variables in SAS

In a recent blog post, I introduced an easy and efficient way to create indicator variables from categorical variables in SAS.  This method pretends to run logistic regression, but it really is using PROC LOGISTIC to get the design matrix based on dummy-variable coding.  I shared SAS code for how to do so, step-by-step. I […]

Read more »

An easy and efficient way to create indicator variables (a.k.a. dummy variables) from a categorical variable in SAS

Introduction In statistics and biostatistics, the creation of binary indicators is a very useful practice. They can be useful predictor variables in statistical models. They can reduce the amount of memory required to store the data set. They can treat a categorical covariate as a continuous covariate in regression, which has certain mathematical conveniences. However, […]

Read more »

Upcoming speaking engagments

April 19, 2018
By
Upcoming speaking engagments

I have a couple of public appearances coming up soon. The East Bay R Language Beginners Group: Preparing Datasets – The Ugly Truth & Some Solutions, Tuesday, May 1, 2018 at Robert Half Technologies, 1999 Harrison Street, Oakland, CA, 94612. Official May 2018 BARUG Meeting: rquery: a Query Generator for Working With SQL Data, Tuesday, … Continue reading Upcoming speaking engagments

Read more »

R Tip: Use Slices

April 17, 2018
By
R Tip: Use Slices

R tip: use slices. R has a very powerful array slicing ability that allows for some very slick data processing. Suppose we have a data.frame “d“, and for every row where d$n_observations < 5 we wish to “NA-out” some other columns (mark them as not yet reliably available). Using slicing techniques this can be done … Continue reading R Tip: Use Slices

Read more »

R Tip: Think in Terms of Values

April 2, 2018
By

R tip: first organize your tasks in terms of data, values, and desired transformation of values, not initially in terms of concrete functions or code. I know I write a lot about coding in R. But it is in the service of supporting statistics, analysis, predictive analytics, and data science. R without data is like … Continue reading R Tip: Think in Terms of Values

Read more »

Video Tutorial – Obtaining the Expected Value of the Exponential Distribution Using the Moment Generating Function

In this video tutorial on YouTube, I use the exponential distribution’s moment generating function (MGF) to obtain the expected value of this distribution.  Visit my YouTube channel to watch more video tutorials!

Read more »

R Tip: Use let() to Re-Map Names

March 26, 2018
By
R Tip: Use let() to Re-Map Names

Another R tip. Need to replace a name in some R code or make R code re-usable? Use wrapr::let(). Here is an example involving dplyr. Let’s look at some example data: library("dplyr") library("wrapr") starwars %>% select(., name, homeworld, species) %>% head(.) # # A tibble: 6 x 3 # name homeworld species # <chr> <chr> … Continue reading R Tip: Use let() to Re-Map Names

Read more »

R Tip: Break up Function Nesting for Legibility

March 21, 2018
By
R Tip: Break up Function Nesting for Legibility

There are a number of easy ways to avoid illegible code nesting problems in R. In this R tip we will expand upon the above statement with a simple example. At some point it becomes illegible and undesirable to compose operations by nesting them, such as in the following code. head(mtcars[with(mtcars, cyl == 8), c("mpg", … Continue reading R Tip: Break up Function Nesting for Legibility

Read more »


Subscribe

Email:

  Subscribe