This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager. | |
RUN PGM=MATRIX PRNFILE="C:\MODELRUN\TRUCKMODEL\CUBE\NPMAT00A.PRN" | |
FILEO PRINTO[1] = "C:\Modelrun\TruckModel\Cube\Inputs\InitStats.RPT" | |
FILEI DBI[1] = "C:\Modelrun\TruckModel\Cube\Inputs\TrucksLoaded.DBF" | |
PAR ZONES = 1 | |
LOOP r = 1, DBI.1.NUMRECORDS | |
x=DBIReadRecord(1, r) | |
IF(DI.1.TSCN > 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source("00Keys.R") | |
source("http://raw.githubusercontent.com/osPlanning/omx/dev/api/r/omx.R") | |
library(ggplot2) | |
library(plyr) | |
hskimpk=readMatrixOMX(paste(modelFolder,"HSKIM_PK1.OMX",sep=""),"TIME") | |
askimam=readMatrixOMX(paste(modelFolder,"AMAsn.OMX",sep=""),"TIME") | |
H5close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reads log files and generates statistics and pretty charts about the closure | |
library(stringr) | |
library(ggplot2) | |
library(scales) | |
# Folder for my model. Change this! | |
modelFolder="C:/Modelrun/GitModel80/Base/" | |
# Reads print files from assignment steps. Change the filenames! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(foreach) | |
countData<-list.files(path="data/",pattern="*.csv") | |
fileList<-foreach(f=files,.combine="rbind") %do% { | |
return(read.csv(paste("data/",f,sep=""))) | |
} | |
# My files are stored in the data subfolder relative to the script location, and they are all .csv files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rjson) | |
library(ggplot2) | |
library(reshape2) | |
url<-'http://www.siliconcreek.net/jsonFiles/2B63LXLE3gfMaYqjGELesD0djGk.json' | |
dat<-fromJSON(file=url, method='C') | |
datdf=lapply(dat,ldply) | |
datdf=ldply(datdf) | |
datdf$obsId=rep(1:(nrow(datdf)/3),each=3) | |
datdf<-dcast(datdf,obsId~.id,value.var="V1") | |
pTemp=ggplot(datdf,aes(x=timestamp,y=temp))+geom_point() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HHSamp<-HH[0,] | |
HHTest<-HH[0,] | |
s=1 | |
t=1 | |
for(i in 1:4){ | |
print(paste(c("Income ",i),collapse="")) | |
for(a in 0:4){ | |
print(paste(c("Autos ",a),collapse="")) | |
ss=subset(HH,TOTVEH==a & INCOME==i) | |
if(nrow(ss)<10 & nrow(ss)>=2){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# AutoOwnership.R | |
# Estimates an auto ownership model | |
# | |
# requires: run ProcessTSkim.R first | |
library(foreign) | |
HH<-subset(read.dbf("data/hhdbf4.dbf"),INCOME<=4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(foreign) | |
library(ggplot2) | |
#This is where my files are at | |
setwd("C:\\Modelrun\\10a10b10a08aV80") | |
#This is the data frame that will hold the output statistics | |
stats<-data.frame(iter=1:99,mae=0,mse=0) | |
#Loop through files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################## | |
# K Factor Example # | |
######################################## | |
# Apply the gravity model | |
gravity<-function(T0,f,k){ | |
Zones=nrow(T0) | |
T1<-matrix(0,Zones,Zones) | |
for(i in 1:Zones){ | |
P=sum(T0[i,]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test data for Philip A. Viton's examples from | |
# http://facweb.knowlton.ohio-state.edu/pviton/courses2/crp5700/Gravity-beamer.pdf | |
# ARohne 11/22/2013 | |
Zones=3 | |
#Trip data | |
T0<-matrix(0,Zones,Zones) | |
T0[1,1]=100 | |
T0[1,2]=350 |