summary information into dataframe ?
Closed this issue · 9 comments
I am new to R, so apologies if this has a simple answer. Let's say I've fitted a model... rather than printing out the summary information using summary(fit)
, is it possible to assign the summary stats (i.e. mean sd HDIlo HDIup etc) to a data frame? I'm attempting to plot posterior summary information in RMarkdown/Knitr, so just wondered how I can extract the info into a variable.
PS, great repo
Thanks!
Hi Benjamin,
That should be as simple as d <- summary(fit)
. Now d contains a large data frame with different summary information regarding the fit.
I'm getting a successful fit, and am doing exactly as you say, but the contents of d is NULL
Which bayes. function ate you running?
On Friday, 10 June 2016, Benjamin T. Vincent notifications@github.com
wrote:
I'm getting a successful fit, and am doing exactly as you say, but the
contents of d is NULL—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#15 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AA9aQDTWtrTVQRx98WTaX4CPqgtXOM-2ks5qKWdygaJpZM4IyXY7
.
/Rasmus
bayes.cor.test()
Everything seems fine, it prints summary to the screen, and I can call plot()
and summary()
just fine.
Right, turns out I was a 100% wrong here. You can get that dataframe by doing this:
d <- summary(fit)
d$stats
But I will change it so that summary(fit) also returns the d$stats
, so let's keep the issue open until I fix that.
Hmm, I'm still getting d
as entirely NULL
, even with d$stats
.
Ah, that was just my copy-paste that failed me, here is what I meant: :)
fit <- bayes.cor.test(...)
fit$stats
superb. That works for me. Will leave issue open as requested. Thanks for your help 👍
summary(fit)
should now also return a matrix with summary statistics of the posterior.