Publications by Nirmal Ghimire, K-16 Literacy Center
Simple Linear Model Tutorial
rm(list = ls()) This tutorial is for my own understanding of the Linear Model function in R. This file will include the following steps: Define the Linear Model Fitting Linear Model using Fake Data & Plotting Linear Model Difference of Difference Examples Regression Discontinuity Examples What is the Linear Model? Estimation of unknown paramete...
19483 sym R (19166 sym/70 pcs) 11 img
Powerball Simulation
This is a hypothetical powerball simulation project. Based on this information, if we want to make 100% sure that we hit the jackpot we need to spend this much money on the tickets (remember each ticket costs $2): choose(69,5)*26*2 ## [1] 584402676 It is in fact $584,402,676. If somebody spends 584 million, 402 hundred thousand, 6 hundred and se...
4355 sym R (6063 sym/25 pcs) 1 img
Special Distribution: Simulation and Graph
Special Distribution Nirmal Ghimire 3/12/2021 Sampling from an exponential using the inverse sampling method Random Draws form Uniform Distribution u<-runif(100000,0,1) str(u) num [1:100000] 0.7516 0.2853 0.0495 0.3173 0.5501 ... Plot the Inverse of CDF of the Exponential library(ggplot2) ##pdf("Runiform_Inverse_Exponential.pdf")#Stores gr...
1992 sym R (7091 sym/33 pcs) 5 img
Downloading and Cleaning Data, Some Preliminary Steps
It is a demonstration of downloading data from an online repository and conducting some intuitive data preparation, and or cleaning activities for further analyses. Thus, I am going to use the hear-disease data which come from the University of California, Irvin online repository, and I am going to use the processed data from Hungarian sample. He...
8669 sym R (12873 sym/52 pcs) 1 img
Fisher's Exact P-value, Sharp Null Hypothesis, and KS Test
Loading Required Libraries, Cleaning the Working Directory and Setting the Directory library(perm) library(devtools) rm(list = ls()) setwd("C:/Users/nirma/Documents/EDX courses/MicroMaster MIT/14.310x-Data Analysis for Social Scientists/Programs") Calculating Fisher’s Exact p-Value How many potential assignments across these 8 subjects are...
10234 sym R (9326 sym/57 pcs) 8 img
Examples on Endogeneity, Instrumental Variables, and Experimental Design
In this part of the problem set, we are going to replicate part of the results of Joshua Angrist and William Evans’ article “Children and Their Parents’ Labor Supply: Evidence from Exogenous Variation in Family Size.” Here is the abstract of the study: Research on the labor-supply consequences of childbearing is complicated by the endogen...
16171 sym R (6226 sym/20 pcs)
R Basic: Part V
Highlights: If-else expression For-loop, While-loop, and Repeat-loop Writing a Function and Return Value Lexical vs. Dynamic Scoping Dates and Times in R setwd("C:/Users/nirma/Documents/GitHub/Practice") Control Structures in R Control structures in R allow us to control the flow of R program. Below is a list of some common basic constructs a...
9069 sym R (8725 sym/95 pcs)
R-Basic Part IV
Overview Understand some of the programming capabilities or R Use basic conditional expression to perform different operations Check if any or all elements fo logical vector are TRUE Define and call functions to perform various operations Pass arguments to functions, and return variables/objects from functions Use for-loops to perform repeated o...
7398 sym R (3712 sym/65 pcs) 7 img
R Basics: Part III
Overview Subset a vector based on properties of another vector. Use multiple logical operators to index vectors. Extract the indices of vector elements satisfying one or more logical conditions. Extract the indices of vector elements matching with another vector. Determine which elements in one vector are present in another vector. * Wrangle dat...
10115 sym R (8229 sym/89 pcs) 7 img
R-Basic Part II
Overview Create numeric and character vectors. Name the columns of a vector. Generate numeric sequences. Access specific elements or parts of a vector. Coerce data into different data types as needed. Sort vectors in ascending and descending order. Extract the indices of the sorted elements from the original vector. Find the maximum and minimum ...
6305 sym R (6951 sym/101 pcs) 1 tbl