Skip to content

Instantly share code, notes, and snippets.

@inkhorn
Last active October 30, 2023 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inkhorn/5601401 to your computer and use it in GitHub Desktop.
Save inkhorn/5601401 to your computer and use it in GitHub Desktop.
not in my backyard casino analysis
library(ff)
library(ggthemes)
ffload(file="casino", overwrite=TRUE)
casino.orig$Outside.of.Toronto = as.ff(ifelse(casino.orig[,"City"] == "Toronto",0,1))
casino.in.toronto = glm(casino.orig[,"Q6"] == "City of Toronto" ~ Outside.of.Toronto, data=casino.orig, family=binomial(logit))
casino.outside.toronto = glm(casino.orig[,"Q6"] == "Adjacent Municipality" ~ Outside.of.Toronto, data=casino.orig, family=binomial(logit))
summary(casino.in.toronto)
Call:
glm(formula = casino.orig[, "Q6"] == "City of Toronto" ~ Outside.of.Toronto,
family = binomial(logit), data = casino.orig)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.9132 -0.9132 -0.7205 1.4669 1.7179
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.21605 0.02600 -46.77 <2e-16 ***
Outside.of.Toronto 0.55712 0.03855 14.45 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 16278 on 13881 degrees of freedom
Residual deviance: 16070 on 13880 degrees of freedom
(3884 observations deleted due to missingness)
AIC: 16074
Number of Fisher Scoring iterations: 4
--------------------------------------------------
summary(casino.outside.toronto)
Call:
glm(formula = casino.orig[, "Q6"] == "Adjacent Municipality" ~
Outside.of.Toronto, family = binomial(logit), data = casino.orig)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.7280 -0.7280 -0.5554 -0.5554 1.9726
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.19254 0.02583 -46.16 <2e-16 ***
Outside.of.Toronto -0.59879 0.04641 -12.90 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 13786 on 13881 degrees of freedom
Residual deviance: 13611 on 13880 degrees of freedom
(3884 observations deleted due to missingness)
AIC: 13615
Number of Fisher Scoring iterations: 4
-------------------------------------------
casino.loc.by.city.res = as.matrix(table(casino.orig[,"Outside.of.Toronto"], casino.orig[,"Q6"])[,2:4], dimnames=list(c("Those Living Inside the City of Toronto", "Those Living Outside the City of Toronto"),colnames(casino.loc.by.city.res)))
rownames(casino.loc.by.city.res) = c("Those Living Inside the City of Toronto", "Those Living Outside the City of Toronto")
casino.loc.by.city.res = melt(prop.table(casino.loc.by.city.res,1))
names(casino.loc.by.city.res) = c("City of Residence","Where to Build the Casino","value")
ggplot(casino.loc.by.city.res, aes(x=casino.loc.by.city.res$"Where to Build the Casino", y=value, fill=casino.loc.by.city.res$"City of Residence")) + geom_bar(position="dodge") + scale_y_continuous(labels=percent) + theme_wsj() + scale_fill_discrete(name="City of Residence") + ggtitle("If a casino is built, where would you prefer to see it located?")
@WalterBray21
Copy link

WalterBray21 commented Oct 29, 2023

Helpful info, thank you! I know nothing about casinos in Canada because I live in Australia, but it was certainly beneficial for me to read this info.
And in general, I think that now it's easier for gamblers to choose a casino to play because there are a lot of blog posts dedicated to it, so that you can find all the info needed to choose the best site to play. Today I found one page and read about $10 no deposit casino bonus, and decided to try a new casino. I chose KatsuBet, you can read more about it on the site if you're interested, and it's actually a good one. The games are cool, and there is a welcoming deposit too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment