Skip to contents

Welcome to the WebR Playground

This interactive environment lets you run Mills ratio examples directly in your browser - no R installation required!

The millsratio package is compiled to WebAssembly and loaded automatically from our custom WebR repository.

Package Setup

First, we load the millsratio package:

Quick Start Examples

Example 1: Basic Mills Ratio Calculation

Try calculating Mills ratios for different distributions. Click “Run Code” to execute:

Example 2: The t(30) Paradox

Explore why t(30) appears normal but has fatter tails:

Example 3: Tidyverse Analysis

Use dplyr and tidyr for Mills ratio analysis:

Example 4: Hazard Function Analysis

Explore the relationship between Mills ratio and hazard function:

Example 6: Verify Mills Ratio Properties

Test the theoretical properties of Mills ratios:

Your Turn! 🚀

Now try modifying the examples above or write your own code. Here’s a blank cell to get started:

Advanced Example: Monte Carlo Verification

Verify Mills ratio calculations using simulation:

Tips for Using WebR Playground

  1. Click “Run Code” to execute any code block
  2. Modify examples directly in the code cells
  3. Core tidyverse packages are available (dplyr, tidyr) - Note: ggplot2 has known issues with WebR, use base plotting instead
  4. Mills ratio functions are pre-loaded - no installation needed
  5. Results appear immediately below each code block

Common Tasks

Compare Any Two Distributions

Explore Different Parameters

Resources

Troubleshooting

If code doesn’t run: 1. Make sure you clicked “Run Code” 2. Check for typos in function names 3. Ensure required libraries are loaded 4. Refresh the page if WebR becomes unresponsive

Happy exploring! 🎯