help(rep)
x <- c(rep("1",40), rep("2",40), rep("3",40), rep("4",40), rep("5+",40))
x
source('~/Development/travel-model/TripGenerator/TripRates.R')
hh.wt <- hh[c("HOUSEID","WTHHFIN","HHSIZE","HHVEHCNT","HOMETYPE")]
hh.wt$HHBIN <- with(hh.wt,{ cut(HHSIZE, breaks=c(0,1,2,3,4,max(HHSIZE)),labels=c("1","2","3","4","5+"),ordered_result=TRUE)})
hh.wt$VEHBIN <- with(hh.wt,{ cut(HHVEHCNT, breaks=c(-1,0,1,2,max(HHVEHCNT)),labels=c("0","1","2","3+"),ordered_result=TRUE)})
hh.wt$DUTYPE <- factor(hh.wt$HOMETYPE, exclude=c("-7","-8","-9"))
levels(hh.wt$DUTYPE) <- c("1","1","2","2","2","2","2")  # Convert home types to 1=SF and 2=MF
levels(hh.wt$HHBIN)
length(levels(hh.wt$HHBIN))
length(levels(hh.wt$HHBIN))*length(levels(hh.wt$VEHBIN))*length(levels(hh.wt$DUTYPE))
help(data.frame)
data.frame(cbind(x=rep(NA,5),y=rep(NA,5)))
source('~/Development/travel-model/TripGenerator/TripRates.R')
source('~/Development/travel-model/TripGenerator/TripRates.R')
View(tr.richmond)
source('~/Development/travel-model/TripGenerator/TripRates.R')
View(tr.richmond)
source('~/Development/travel-model/TripGenerator/TripRates.R')
source('~/Development/travel-model/TripGenerator/TripRates.R')
View(trip.table)
View(tr.virginia)
View(tr.richmond)
View(day)
View(hh)
View(veh)
View(per)
source('~/Development/travel-model/TripGenerator/TripRates.R')
View(tr.virginia)
View(veh)
View(trip.table)
trips.person <- with(trips,{})
View(trip.table)
trips.person <- with(trips,{aggregate(trips["WTTRDFIN"],by=PURPOSE,sum)})
trips.person <- with(trip.table,{aggregate(trip.table["WTTRDFIN"],by=PURPOSE,sum)})
trips.person <- with(trip.table,{aggregate(trip.table["WTTRDFIN"],by=list(PURPOSE=PURPOSE),sum)})
View(trips.person)
trips.person$WTTRDFIN <- trips.person$WTTRDFIN/365
View(trips.person)
hh.wt <- with(trip.table,{aggregate(trip.table["WTHHFIN"],by=list(PURPOSE=PURPOSE),sum)})
View(hh.wt)
help(merge)
trips.per.person.per.day.by.purpose <- merge(trips.person,hh.wt,by=c("PURPOSE"))
View(trips.per.person.per.day.by.purpose)
trips.per.person.per.day.by.purpose$trip.rate <- with(trips.per.person.per.day.by.purpose,{WTTRDFIN/WTHHFIN})
View(trips.per.person.per.day.by.purpose)
with(trips.per.person.per.day.by.purpose,{sum(trip.rate)})
View(tr.virginia)
source('~/Development/travel-model/TripGenerator/TripRates.R')
trip.rates.by.purpose(trip.table)
trip.rates.by.purpose <- function(trips)
{
t1 <- with(trips,{aggregate(trips["WTTRDFIN"],by=list(PURPOSE=PURPOSE),sum)})
t2 <- with(trips,{aggregate(trips["WTHHFIN"],by=list(PURPOSE=PURPOSE),sum)})
t3 <- merge(t1,t2,by=c("PURPOSE"))
t3$trip.rate <- with(t3,{WTTRDFIN/365/WTHHFIN})
return(t3)
}
trip.rates.by.purpose(trip.table)
trip.table <- create.trips(day,hh)
trip.rates.by.purpose(trip.table)
source('~/Development/travel-model/TripGenerator/TripRates.R')
View(trip.table)
source('~/Development/travel-model/TripGenerator/TripRates.R')
View(trip.table)
View(day)
source('~/Development/travel-model/TripGenerator/TripRates.R')
source('~/Development/travel-model/TripGenerator/TripRates.R')
source('~/Development/travel-model/TripGenerator/TripRates.R')
View(trip.table)
wtd.mean(trip.table$RATE,weights=trip.table$WTHHFIN)
source('~/Development/travel-model/TripGenerator/TripRates.R')
tmp <- with(trip.table,{aggregate(trip.table["RATE"],by=list(PERSONID=PERSONID),sum)})
View(tmp)
tmp <- with(trip.table,{aggregate(trip.table["RATE"],by=list(HOUSEID=HOUSEID,PERSONID=PERSONID),sum)})
View(tmp)
mean(tmp$RATE)
View(per)
tmp[tmp$HOUSEID == "20000017"]
tmp[,tmp$HOUSEID == "20000017"]
tmp[tmp$HOUSEID == "20000017",]
View(trip.table)
View(tmp)
View(tr.us)
View(trip.table)
View(tmp)
help(aggregate)
tmp1 <- with(trip.table,{aggregate(trip.table["WTTHHFIN"],by=list(HOUSEID=HOUSEID,PURPOSE=PURPOSE),sum)})
tmp1 <- with(trip.table,{aggregate(trip.table["WTHHFIN"],by=list(HOUSEID=HOUSEID,PURPOSE=PURPOSE),sum)})
View(tmp1)
tmp1 <- with(trip.table,{aggregate(trip.table["WTHHFIN","WTTRDFIN"],by=list(HOUSEID=HOUSEID,PURPOSE=PURPOSE),sum)})
tmp2 <- with(trip.table,{aggregate(trip.table["WTTRDFIN"],by=list(HOUSEID=HOUSEID,PURPOSE=PURPOSE),sum)})
View(tmp2)
help(merge)
tmp3 <- merge(tmp1,tmp2,by=c("HOUSEID","PURPOSE"))
View(tmp3)
source('~/Development/travel-model/TripGenerator/TripRates.R')
source('~/Development/travel-model/TripGenerator/TripRates.R')
rm(list=ls())
source('~/Development/travel-model/TripGenerator/TripRates.R')
source('~/Development/travel-model/TripGenerator/TripRates.R')
trips <- trip.table
tmp1 <- with(trips,{aggregate(trips["WTHHFIN"],by=list(HOUSEID=HOUSEID,PURPOSE=PURPOSE),sum)})
tmp2 <- with(trips,{aggregate(trips["WTTRDFIN"],by=list(HOUSEID=HOUSEID,PURPOSE=PURPOSE),sum)})
tmp3 <- merge(tmp1,tmp2,by=c("HOUSEID","PURPOSE"))
tmp3$Rate <- (tmp3$WTTRDFIN/365)/tmp3$WTHHFIN
View(tmp3)
trout <- c(1,1,0)
mean(trout)
sd(trout)
help(runif)
tmp <- runif (2000,min=0,max=1)
dim(tmp) <- c(1000,2)
View(tmp)
df <- data.frame(tmp)
names(df) <- c("x","y")
View(df)
df$X2plusY2 <- df$x^2 + df$y^2
View(df)
m <- df$X2pluY2[df$X2plusY2 <= 1]
tmp <- subset(df, X2plusY2 <= 1)
m <- length(tmp$x)
pi <- m/n * 4
pi <- m/1000 * 4
rm(list=ls())
source('~/Public/mc-pi.R')
source('~/Public/mc-pi.R')
help(pi)
pi
(MC.1k-pi)/pi
(MC.1K-pi)/pi
(MC.10K-pi)/pi
(MC.100K-pi)/pi
(MC.1M-pi)/pi
(MC.10M-pi)/pi
(MC.10M-pi)/pi*1000
(MC.100M-pi)/pi*1000
(MC.100M-pi)/pi
MC.1K/4*1000
source('~/Public/mc-pi.R')
rm(list=ls())
pi
help(abs)
source('~/Public/mc-pi.R')
source('~/Public/mc-pi.R')
source('~/Public/mc-pi.R')
source('~/Public/mc-pi.R')
gr <- 0.005
df <- data.frame(Year=c(2000:2030))
View(df)
df$Count <- 10000*((1+gr)^(df$Year-2000))
View(df)
gr <- 0.01
df$Count <- 10000*((1+gr)^(df$Year-2000))
View(df)
plot(df$Year,df$Count)
gr <- 0.02
df$Count <- 10000*((1+gr)^(df$Year-2000))
plot(df$Year,df$Count)
gr <- 0.03
df$Count <- 10000*((1+gr)^(df$Year-2000))
plot(df$Year,df$Count)
plot(df$Year,df$Count,pch=20)
lines(df$Year,df$Count)
lm.df <- lm(df$Count ~ df$Year)
summary(lm)
summary(lm.df)
source('~/growth.R')
source('~/growth.R')
source('~/growth.R')
source('~/growth.R')
source('~/growth.R')
help(predict)
predic(lm.df)
predict(lm.df)
df$forecast <- predict(lm.df)
View(df)
source('~/growth.R')
source('~/growth.R')
lm.df$coef
source('~/growth.R')
source('~/growth.R')
m.2000 <- mean((mc.lm$a*2000+mc.lm$b))
sd.2000 <- sqrt(var(mc.lm$a*2000+mc.lm$b))
View(mc.lm)
source('~/growth.R')
View(mc.lm)
source('~/growth.R')
summary(lm.df)$coef[1,1]
summary(lm.df)$coef[1,1]
summary(lm.df)$coef[1,2]
source('~/growth.R')
source('~/growth.R')
View(df)
source('~/growth.R')
View(df)
source('~/growth.R')
source('~/growth.R')
source('~/Documents/HourlyGlucoseLevels.R')
help(plot)
source('~/Documents/HourlyGlucoseLevels.R')
help(ylim)
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
help(text)
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
help(pdf)
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
help(plot)
source('~/Documents/HourlyGlucoseLevels.R')
source('~/Documents/HourlyGlucoseLevels.R')
t <- seq(0,255)
t
r <- t % 6
help(mod)
??mod
??modulus
r <- t %% 6
r
hist(r)
t <- seq(0,65535)
r <- t %% 100
hist(r)
r <- t %% 99
hist(r)
r <- t %% 92
hist(r)
t <- seq(0,255)
r <- t / 42
r
r <- int(r)
r <- integer(r)
help(as)
??int
??floor
??integers
r <- as.integer(r)
r
hist(r)
a <- seq(0,255)
a
f <- a % 20
help(mod)
??mod
??modulus
f <- a %% 20
f
hist(f)
a <- seq(0,65535)
f <- a %% 20
hist(f)
a <- seq(0,255)
f <- a %% 20
hist(f)
??freq
??hist
t <- hist(f)
t
t <- hist(f,breaks=20)
t
a <- seq(0,255)
f <- a %% 20
h <- hist(f, breaks=20)
h
f
a <- seq(0,255)
f <- a %% 10
f
h <- hist(f,breaks=11)
h
h <- hist(f,breaks=c(-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5))
h
h <- hist(f,breaks=c(-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5))
h
setwd("~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice")
library(foreign)
data <- read.csv("dice.txt")
View(data)
help(frequency)
help(table)
data$sum <- data$Die1 + data$Die2
View(data)
help(hist)
hist(data$sum)
hist(data$sum, freq=false)
hist(data$sum, freq=FALSE)
hist(data$sum, freq=FALSE, breaks=c(0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5))
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
rm(data)
help(rbind)
t <- rbind(Dice.data$Die1,Dice.data$Die2)
t
View(t)
t <- cbind(Dice.data$Die1,Dice.data$Die2)
View(t)
t <- c(Dice.data$Die1,Dice.data$Die2)
fix(t)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
rm(t)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
View(Dice.data)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
freq(Independent.Rolls)
??freq
library(prettyR)
freq(Independent.Rolls)
freq(Independent.Rolls, display.na=FALSE,decr.order=FALSE)
Independent.Rolls.freq <- freq(Independent.Rolls, display.na=FALSE,decr.order=FALSE)
fix(Independent.Rolls.freq)
Independent.Rolls.freq
Independent.Rolls.freq[1,2]
Independent.Rolls.freq[1]
Independent.Rolls.freq[2]
Independent.Rolls.freq[2][1]
Independent.Rolls.freq[2][2]
Dice.data.freq <- freq(Dice.data, display.na=FALSE,decr.order=FALSE)
freq(Dice.data, display.na=FALSE,decr.order=FALSE)
fix(Dice.data.freq)
Dice.data.freq["Sum"]
t <- Dice.data.freq["Sum"]
t[1]
t[,1]
t$2
t <- as.matrix(Dice.data.freq["Sum"])
t
t <- as.data.frame(Dice.data.freq["Sum"])
t
rm(list=ls())
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
View(Dice.data.freq)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
fix(Independent.Rolls.freq)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
View(Independent.Rolls.freq)
Independent.Rolls.freq[1]
Independent.Rolls.freq[,1]
Independent.Rolls.freq$Independent.Rolls[,1]
Independent.Rolls.freq$Independent.Rolls[1]
Independent.Rolls.freq$Independent.Rolls[2]
chisq.test(Dice.data.freq)
chisq.test(Independent.Rolls.freq)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
View(Independent.Rolls.freq)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
help(chisq.test)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
chisq.test(c(35,40,25),p=c(35,35,30))
chisq.test(c(35,40,25),p=c(.35,.35,.30))
View(Dice.data.freq)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
View(t)
t$IDEAL <- sum(t$SUM)*t$P
tot <- sum(t$SUM)
t
t$SUM
t[1,]
t[,1]
sum(t[,1])
sum(Dice.data.freq[,1])
t$IDEAL <- sum(sum(Dice.data.freq[,1]))*t$P
t$IDEAL <- sum(sum(Dice.data.freq[,1]))*t[,2]
t$IDEAL <- sum(Dice.data.freq[,1])*t[,2]
t$IDEAL <- sum(Dice.data.freq[,1])
t
rm(t)
t <- cbind(SUM=Dice.data.freq$Sum,P=c(0.0278,0.0556,0.0833,0.1111,0.1389,0.1667,0.1389,0.1111,0.0833,0.0556,0.0278))
t$IDEAL <- sum(Dice.data.freq[,1])*t[,2]
t
rm(t)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
View(t)
sum(t$V1)
sum(t[,1])
t[,3] <- sum(t[,1])*t[,2]
t
tot <- sum(t[,1])
tot
t[,3] <- tot*t[,2]
t <- as.data.frame(t)
t
t$V3 <- tot*t$V2
t
sum(Dice.data.freq$Sum)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
p
View(Dice.data.freq)
View(Dice.data.freq)
t <- chisq.test(Dice.data.freq$Sum), p=c(0.0278,0.0556,0.0833,0.1111,0.1389,0.1667,0.1389,0.1111,0.0833,0.0556,0.0278)
t <- chisq.test(Dice.data.freq$Sum, p=c(0.0278,0.0556,0.0833,0.1111,0.1389,0.1667,0.1389,0.1111,0.0833,0.0556,0.0278)
)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
sum(p)
sum(c(0.0278,0.0556,0.0833,0.1111,0.1389,0.1667,0.1389,0.1111,0.0833,0.0556,0.0278))
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
sum(c(0.0278,0.0556,0.0833,0.1111,0.1389,0.1667,0.1389,0.1111,0.0833,0.0556,0.0278))
sum(c(0.0278,0.0556,0.0833,0.1111,0.1389,0.1666,0.1389,0.1111,0.0833,0.0556,0.0278))
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
help(png)
source('~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice/analyze.R')
