dgrtwo / dgrtwo.github.com Goto Github PK
View Code? Open in Web Editor NEWMy website
License: MIT License
My website
License: MIT License
I'm having an issue running the example from "Understanding empirical Bayesian hierarchical modeling (using baseball statistics)"
http://varianceexplained.org/r/hierarchical_bayes_baseball/
I run everything before and up to:
crossing(bats = c("L", "R"),
AB = c(10, 100, 1000, 10000)) %>%
augment(fit2, newdata = .) %>%
mutate(H = .3 * AB,
alpha0 = .fitted / sigma,
beta0 = (1 - .fitted) / sigma,
alpha1 = alpha0 + H,
beta1 = beta0 + AB - H,
estimate = alpha1 / (alpha1 + beta1),
conf.low = qbeta(.025, alpha1, beta1),
conf.high = qbeta(.975, alpha1, beta1),
record = paste(H, AB, sep = " / ")) %>%
ggplot(aes(estimate, record, color = bats)) +
geom_point() +
geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) +
labs(x = "Estimate w/ 95% credible interval",
y = "Batting record",
color = "Batting hand")
and get:
Error in mutate_impl(.data, dots) :
Evaluation error: non-numeric argument to binary operator.
I figured out the error is coming from the fact that sigma
is a function, and so is causing the calculation of alpha0
to fail. I'm not too familiar with tidyr, and so am not sure how to pull out sigma for the predicted/fitted new data...
I appreciate your help in advance!
I could not figure out how to use inflate function properly...
When I reproduce what you implemented, I've got the following errors.
http://varianceexplained.org/r/bayesian_ab_baseball/
two_players %>%
+ broom::inflate(x = seq(.28, .33, .00025)) %>%
+ mutate(density = dbeta(x, alpha1, beta1)) %>%
+ ggplot(aes(x, density, color = name)) +
+ geom_line() +
+ labs(x = "Batting average", color = "")
Error in mutate_impl(.data, dots) :
Evaluation error: object 'alpha1' not found.
Hey David, fan of your site. I'm trying to use Minimal Mistakes as well - was wondering how you left-aligned the masthead links?
Thanks.
Hello David,
I'm using the minimal mistakes theme for my blog
Could you advice on how did you create the "Subscribe" feature in your blog.
Thank you for your time.
Cheers
Ashish
I enjoyed your post on "Examining the arc of 100,000 stories" - thanks! For me the associated RMarkdown file raises the following error:
Line 204: Error in FUN(X[[i]], ...) : object 'decile' not found
It looks like this is a result of joining two tables containing the same decile
column name.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.