Giter Site home page Giter Site logo

Comments (6)

masurp avatar masurp commented on September 28, 2024

Dear Karl,

in the current version, you can add groups of control variables (and their combination) as follows:

library(specr)

results <- run_specs(
  df = dplyr::mutate(example_data, c3 = runif(dplyr::n())), 
  y = c("y1", "y2"), 
  x = c("x1", "x2"), 
  model = c("lm"), 
  controls = c("c1 + c2", "c1 + c3")  # note the different notation here
)
dplyr::distinct(results, controls)
#> # A tibble: 4 x 1
#>   controls         
#>   <chr>            
#> 1 c1 + c2 + c1 + c3
#> 2 c1 + c2          
#> 3 c1 + c3          
#> 4 no covariates  

As you can see, the function produces also the combination of the "combinations". You would need to remove this specification afterwards, if it doesn't make sense to you.

We have considered including all combinations of controls, but as you said that increases the amount of specifications considerably (and for a standard routine potentially unnecessarily). I'll have to think about this more and might add some more standardized procedures in the next version.

Hope this helps!

from specr.

karldw avatar karldw commented on September 28, 2024

Hi @masurp,

Ah, that's very helpful, thank you!

Another tool that might be useful is purrr::cross_df and its .filter argument, which could be used in place of expand.grid in setup_specs to drop specifications before they're run.
(If that change sounds useful, I would be happy to submit a PR in a few weeks.)

from specr.

maswiebe avatar maswiebe commented on September 28, 2024

results <- run_specs(
df = dplyr::mutate(example_data, c3 = runif(dplyr::n())),
y = c("y1", "y2"),
x = c("x1", "x2"),
model = c("lm"),
controls = c("c1 + c2", "c1 + c3") # note the different notation here
)
plot_specs(results)

One problem with this approach is that the graph doesn't recognize "c1+c2" or "c1+c3" as separate groups in the 'controls' section. Instead, they get lumped together as 'all covariates':
image

from specr.

masurp avatar masurp commented on September 28, 2024

Hi,

run_specs() no longer puts them together in the newest development version. Please install the latest version, and it should print them all separately. Will push to CRAN soon.

Best,
Philipp

from specr.

maswiebe avatar maswiebe commented on September 28, 2024

Great, that works!

from specr.

akarlinsky avatar akarlinsky commented on September 28, 2024

I just found out on my own that I can include "groups" using this notation and it's very useful. Can this be added to the guides on the website?

from specr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.