Skip to content

Instantly share code, notes, and snippets.

Francis Smart EconometricsBySimulation

Block or report user

Report or block EconometricsBySimulation

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:fe40ec9f749213d1240011684001dda5

emailto: psteiner@umd.edu student: Francis Smart fsmart@gmail.com EDMS769G

# Text Network graph
#           Student Ability _______________________
#            /           |                         \_____
#          /             |  Public/Private Transport     \
#         ↓              ↓     ↓                          ↘
@EconometricsBySimulation
EconometricsBySimulation / lmOut
Last active Oct 9, 2018
A simple command to grab coefficients, t-stats, p-values, f-stats, etc from a regression and export them as an easy to use spreadsheet.
View lmOut
lmOut <- function(res, file="test.csv", ndigit=3, writecsv=T) {
# If summary has not been run on the model then run summary
if (length(grep("summary", class(res)))==0) res <- summary(res)
co <- res$coefficients
nvar <- nrow(co)
ncol <- ncol(co)
f <- res$fstatistic
formatter <- function(x) format(round(x,ndigit),nsmall=ndigit)
View ConsumptionInference.R
# Estimating Weekly consumption from periodic purchasing data
library(dplyr)
library(data.table)
library(reshape)
library(tidyr)
library(ggplot2)
# Day Purchase
View FEC-Clinton-PieCharts.R
rm(list=ls())
library(data.table)
library(dplyr)
library(ggplot2)
library(scales)
setwd('Z:/Data/FEC')
dsum <- function(...) dplyr::summarize(...)
View Campaign-Finance-Density.R
rm(list=ls())
library(data.table)
library(dplyr)
library(ggplot2)
setwd('Z:/Data/FEC')
dsum <- function(...) dplyr::summarize(...)
to.data.table <- function(x) {(class(x) <- class(data.table())) ;x}
View 2013-08-21-Doodler
# R - Doodling in R
# I am working on creating some functions that will be capable of creating shapes and plots that look hand drawn.
# I have made some progress in this goal.
# In that process I have also discovered that I can make some doodles that look hand drawn as well.
# In order to accomplish the goal of simulating hand drawing I want to simulate the momentum of hand writing.
@EconometricsBySimulation
EconometricsBySimulation / gist:6235945
Created Aug 14, 2013
2013-07-30 A bit of code showing how to do Structural Equation Modelling
View gist:6235945
clear
set obs 4000
gen id = _n
gen eta1 = rnormal()
gen eta2 = rnormal()
* Generate 5 irrelevant factors that might affect each of the
View server.r
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# Take a dependency on input$goButton
input$goButton
# Use isolate() to avoid dependency on input$obs
dist <- isolate(rnorm(input$obs))
hist(dist)
})
})
View heightweight.csv
sex ageYear ageMonth heightIn weightLb
f 11.91667 143 56.3 85
f 12.91667 155 62.3 105
f 12.75 153 63.3 108
f 13.41667 161 59 92
f 15.91667 191 62.5 112.5
f 14.25 171 62.5 112
f 15.41667 185 59 104
f 11.83333 142 56.5 69
f 13.33333 160 62 94.5
View server.r
shinyServer(function(input, output) {
output$main_plot <- renderPlot(width = 400, height = 300, {
hist(faithful$eruptions,
probability = TRUE,
breaks = as.numeric(input$n_breaks),
xlab = "Duration (minutes)",
main = "Geyser eruption duration")
You can’t perform that action at this time.