Comments (6)
Hello, thanks for creating such an amazing package for summarizing simulation results. I saw this issue so I want to add a small suggestion here. It seems the print.summary.simsum() function will only print those nice tables but the summary tables are not returned. This is somewhat inconvenient for channeling the R output for other uses. I know I can extract the "tidy" long table from the summary object directly or use the tidy() function but they are not good for presentation purposes. What are your thoughts on this? Thank you very much!
from rsimsum.
Hi, thanks for your feedback!
Just to understand better your comment, would you like print.summary.simsum()
to return the formatted tables that are printed to the R console?
from rsimsum.
Yes. I'll be more specific. Allow me to explain.
Currently the print.summary.simsum()
doesn't return anything other than printing the required summary tables. Personally, I think a better design is that it returns a (list) of summary data frames, maybe the output
object in your code. I want this feature because such tables are better suited for presenting the results than the tidy format summary tables if I have a methodvar
. And I cannot really use R's printed data frame conveniently for other purposes, e.g., making it into kables.
### If methodvar, put them side by side
if (!is.null(x$methodvar)) {
x$summ <- .bind_methods(data = x$summ, by = x$by, methodvar = x$methodvar)
}
### Split by summary statistics for printing
x$summ[["Performance Measure"]] <- droplevels(x$summ[["Performance Measure"]])
output <- .split_by(data = x$summ, by = "Performance Measure")
### Print
for (i in seq_along(output)) {
cat(paste0("\n", names(output)[i], ":\n"))
output[[i]][["Performance Measure"]] <- NULL
print(output[[i]], row.names = FALSE)
}
from rsimsum.
Aha, now I see – something like the example below?
library(rsimsum)
s2 <- simsum(data = relhaz, estvarname = "theta", true = -0.50, se = "se", methodvar = "model", by = c("baseline", "n"))
#> 'ref' method was not specified, Cox set as the reference
a <- print(summary(s2, stats = "bias"))
#> Values are:
#> Point Estimate (Monte Carlo Standard Error)
#>
#> Bias in point estimate:
#> baseline n Cox Exp RP(2)
#> Exponential 50 0.0215 (0.0328) 0.0239 (0.0326) 0.0183 (0.0331)
#> Exponential 250 -0.0215 (0.0149) -0.0214 (0.0151) -0.0227 (0.0149)
#> Weibull 50 -0.0282 (0.0311) 0.1509 (0.0204) -0.0348 (0.0311)
#> Weibull 250 -0.0120 (0.0133) 0.1482 (0.0093) -0.0139 (0.0137)
library(knitr)
#>
#> Attaching package: 'knitr'
#> The following object is masked from 'package:rsimsum':
#>
#> kable
kable(a[[1]], caption = names(a)[1], align = "r")
baseline | n | Cox | Exp | RP(2) |
---|---|---|---|---|
Exponential | 50 | 0.0215 (0.0328) | 0.0239 (0.0326) | 0.0183 (0.0331) |
Exponential | 250 | -0.0215 (0.0149) | -0.0214 (0.0151) | -0.0227 (0.0149) |
Weibull | 50 | -0.0282 (0.0311) | 0.1509 (0.0204) | -0.0348 (0.0311) |
Weibull | 250 | -0.0120 (0.0133) | 0.1482 (0.0093) | -0.0139 (0.0137) |
Bias in point estimate
Created on 2021-09-16 by the reprex package (v2.0.1)
from rsimsum.
Yes, that's fantastic!
from rsimsum.
Awesome! I just pushed this updated version to GitHub, you can try it out with:
library(remotes)
remotes::install_github("ellessenne/github")
Let me know your thoughts it you get the chance to play around with it! 😃
from rsimsum.
Related Issues (20)
- Issue when number of simulations per data-generating mechanism are not of equal size HOT 9
- Release rsimsum 0.10.0 HOT 1
- Release rsimsum 0.10.1
- Passing a column of p-values for calculating power HOT 1
- Small correction to reference to plotting vignette in autoplot helpfiles HOT 1
- Release rsimsum 0.11.0
- Conflicts with {broom}'s tidy() HOT 1
- Release rsimsum 0.11.1
- Zip plot is missing/overlapping confidence intervals. HOT 3
- Relative bias HOT 1
- Release rsimsum 0.11.3
- autoplot() with type = "est_density"
- Discrepancy between code and formula in paper HOT 3
- When using the `by` argument all factorial combinations of the elements must exist in the summary dataset else an error is thrown. HOT 5
- true variable cannot also be in by HOT 2
- estvarname cannot be named est HOT 2
- Error 403 for some URLs HOT 2
- Improve control functionality
- Issue reported by CRAN regarding @docType HOT 1
- Release rsimsum 0.13.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rsimsum.