• Home
  • About blog
  • About us
  • Resources

My Statistical Consultant Blog

Resources for those intending to use statistics software and research methods

R

Quick start with R: aggregate() command (Part 10)

By David Lillis on Wednesday, June 13, 2018

In Part 10, let’s look at the aggregate() command for creating summary tables using R. You may have a complex dataset that includes categorical variables of several levels, and you may wish to create summary tables for each level of the categorical variable. For example, your dataset may include the variable Gender, a two-level categorical …

Continue Reading
0
R & Shiny codes

Using a recursive function to conditionally aggregate a contingency table

By Miloš Vilotić on Friday, June 8, 2018

In this post, we will show on a simple example the application of a recursive function. The problem that we want to solve is the following. We have a matrix of dimensions N x M. This can be, for example, a two-dimensional contingency table. Columns that have a mean value less than the set value …

Continue Reading
0
R

Quick start with R: Sub-setting (Part 9)

By David Lillis on Sunday, June 3, 2018

In Part 9, let’s look at sub-setting in R. Let’s provide summary tables on the following data set of tourists from different countries, the numbers of their children, and the amount of money they spent while on vacation. Copy and paste the following array into R. A <- structure(list(NATION = structure(c(3L, 3L, 3L, 3L, 1L, …

Continue Reading
0
R

Quick start with R: Basic commands (Part 8)

By David Lillis on Thursday, May 31, 2018

In Part 8, let’s look at some basic commands in R. Set up the following vectors by cutting and pasting from this document: a <- c(3,-7,-3,-9,3,-1,2,-12, -14) b <- c(3,7,-5, 1, 5,-6,-9,16, -8) d <- c(1,2,3,4,5,6,7,8,9) Now figure out what each of the following commands do. You should not need me to explain each command, …

Continue Reading
0
Shiny apps

Using Sample Size Calculator application

By Zlatko Kovačić on Wednesday, May 30, 2018

The following video tutorial gives a brief overview of the Sample Size Calculator application. The Sample Size Calculator is an interactive Shiny application which allows you to calculate sample size when estimating population mean value or population proportion.  

Continue Reading
0
R

Quick start with R: Further plotting (Part 7)

By David Lillis on Tuesday, May 29, 2018

In Part 7, let’s look at further plotting in R. Try entering the following three commands to create three variables. X <- c(3, 4, 6, 6, 7, 8, 9, 12) B1 <- c(4, 5, 6, 7, 17, 18, 19, 22) B2 <- c(3, 5, 8, 10, 19, 21, 22, 26) Graph B1 using a y …

Continue Reading
0
R

Quick start with R: Basic plotting (Part 6)

By David Lillis on Saturday, May 26, 2018

In Part 6, let’s look at basic plotting in R. Try entering the following three commands together (the semi-colon allows you to place several commands on the same line). x <- seq(-4, 4, 0.2) ;  y <- 2*x^2 + 4*x – 7 plot(x, y) This is a very basic plot, but we can do much …

Continue Reading
0
R

Quick start with R: Exponential models (Part 5)

By David Lillis on Wednesday, May 23, 2018

In Parts 3 and 4 we used the lm() command to perform least squares regressions. We saw how to check for non-linearity in our data by fitting polynomial models and checking whether they fit the data better than a linear model. Now let’s see how to fit an exponential model in R. As before, we …

Continue Reading
0
R

Quick start with R: Advanced regression models (Part 4)

By David Lillis on Tuesday, May 22, 2018

In Part 3 we used the lm() command to perform least squares regressions. In Part 4 we will look at more advanced aspects of regression models and see what R has to offer. One way of checking for non-linearity in your data is to fit a polynomial model and check whether the polynomial model fits …

Continue Reading
0
R

Quick start with R: More about regression (Part 3)

By David Lillis on Thursday, May 17, 2018

In Part 2 we created two variables and used the lm() command to perform a least squares regression on them, treating one of them as the dependent variable and the other as the independent variable. Here they are again. height = c(186, 165, 149, 206, 143, 187, 191, 179, 162, 185) weight = c(89, 56, …

Continue Reading
0

Posts navigation

← Previous 1 2 3 4 Next →
Recent Posts
  • Quick start with R: Improving our regression model (Part 29) September 10, 2018
  • Quick start with R: Diagnosing our regression model (Part 28) September 4, 2018
  • Quick start with R: More on regression (Part 27) August 31, 2018
Categories
  • Instructions(3)
  • R(31)
  • R & Shiny codes(2)
  • Research(1)
  • Shiny apps(1)
Keywords
Bootstrap Contingency table Econometrics EViews Instructions R Shiny Stata Statistics Video
(c) 2018-2020 My Statistical Consultant Ltd | Theme by Scissor Themes Proudly powered by WordPress