Logistic Regression with Single Predictor in R

Plotting logistic regression model with geom_smooth()

In this post, we will learn how to perform a simple logistic regression using Generalized Linear Models (glm) in R. We will work with logistic regression model between a binary categorical variable as response variable and a single numerical predictor. Data for logistic regression Let us load the packages needed. We will use two variables… Continue reading Logistic Regression with Single Predictor in R

Simple Barpots and reordering bars in R

Reorder barplot by a variable using fct_reorder()

In this post, we will learn how to make simple barplot using ggplot2 and learn to reorder barplots in R. We will make a barplot using ggplot2’s geom_col() with multiple bars. By default, ggplot2 orders the bars in alphabetical order. We will see examples of reordering barplots by another numerical variable in the data using… Continue reading Simple Barpots and reordering bars in R

3 ways to rank numbers with tidyverse

In this tutorial, we will learn 3 ways to rank integers in tidyverse. Tidyverse’s dplyr has three integer ranking functions, row_number(), min_rank(), and dense_Rank(), inspired by SQL. And these integer ranking functions differ in how they handle ties. Let us jump into simple examples as given by dplyr and create tibble with a sorted column… Continue reading 3 ways to rank numbers with tidyverse

Compute rowwise mean and standard deviation

In this post, we will learn how to compute row-wise summary statistics like mean and standard deviation using dplyr’s row_wise() function. First, let us load tidyverse and verify the version of dplyr. Let us create a toy dataframe with five columns. We use sample() function to create some random vector. And then use matrix() function… Continue reading Compute rowwise mean and standard deviation

Exit mobile version