This is the third part of a series surrounding survival analysis. For part 1, click here. For part 2, click here. This particular post follows the final part of fitting a Cox proportional hazards model; residual checking and model validation. Solutions can be found for these exercises here. Exercise 1 Load the survival and survminer libraries. Build our […]
statistics
Introduction to Statistical Testing and Sampling Exercises (Part 2)
This is part 2 in a series on statistical theory using R. For part 1, go here. This tutorial concerns itself with MLE calculations and bootstrapping. Answers to the exercises are available here. Exercise 1 Set a seed to 123 and create the following dataframe: lifespans = data.frame(index = 1:200, lifespans = rgamma(200, shape = 2, […]
Introduction to Statistical Testing and Sampling: Exercises (Part 1)
For a majority of users, the primary use of R is for statistical testing and analysis. At the heart of this, within the frequentist world, lies hypothesis testing and distribution sampling. The skill in conducting this sort of work is being able to identify an appropriate distribution on which to model the question and test […]
Predicting Housing Prices with Linear Regression Exercises
Regression techniques are a crucial skill in any data scientist or statisticians toolkit. It is even crucial for people who are unfamiliar with regression modeling. It is a nice way to introduce yourself to the topic through a simple linear model. A linear model is an explanation of how a continuous response variable behaves, dependent […]
Basic Bayesian Inference for MCMC techniques : Solutions (Part 1)
Below are the solutions to these exercises on “Bayesian Inference : introduction for MCMC techniques (part 1)”. ############### # # # Exercise 1 # # # ############### # a. Binomial distribution with n = 1000 and probability of ‘success’ = 735/1000 plot(dbinom(x = seq(1, 100, 1), size = 100, prob = 735/1000), type = "l", […]
Machine Learning With H2O Part 3: Exercises
This is the last of the exercise set on H2O’s machine learning algorithms. Please do them in sequence. This requires some additional data. I have provided the links, so please download them when it’s needed. Answers to the exercises are available here. Please check the documentation before starting this exercise set. For other parts of […]
Machine Learning With H2O Part 3 Solutions
Below are the solutions to these exercises on h2o and machine learning ############### # # # Exercise 1 # # # ############### setwd("H20/") library(h2o) cluster.h <- h2o.init() bank_data <- h2o.importFile("data\bank.csv") response = "y" predictors <- c("age","job","marital","education","default","balance","housing","loan") splits <- h2o.splitFrame(bank_data,c(0.8,0.1)) train <- splits[[1]] valid <- splits[[2]] test <- splits[[3]] gbm.m <- h2o.gbm(x, y, train, nfolds = […]
Power Analysis Exercises: Solutions
Below are the solutions to these exercises on Conducting Power Analysis for Experimental Design. #################### # # # Exercise 1 # # # #################### install.packages(‘pwr’, dependencies = TRUE) ## Error in contrib.url(repos, “source”): trying to use CRAN without setting a mirror require(pwr) ## Loading required package: pwr #################### # # # Exercise 2 # […]
Power Analysis: Exercises
Proper experimental design can save you a lot of headaches and wasted effort. One experimental design tool is often called a Power Analysis. A Power Analysis lets you determine if your design will have enough power to detect an effect. Statistical power is the probability of detecting a trend, given a trend actually exists. Importantly, […]
Survival Analysis: Exercises (Part 2)
This is the second part of a series on conducting Survival Analysis in R using Survival and Survminer. It is advised to first complete the first set of exercises (here) before attempting these, as there is a direct continuation of knowledge. The second part of this series focuses on more complex and insightful methods through […]