Coder Social home page Coder Social logo

Comments (4)

wjakethompson avatar wjakethompson commented on June 6, 2024

What does devtools::session_info(c("dplyr", "tidyr")) give you?

from measr.

ralmond avatar ralmond commented on June 6, 2024

Ah! I had older versions of dplyr and tidyr set (from Debian sources rather than direct from CRAN).

Next I ran into a problem as the test suite uses cmdstanr which is not on CRAN. You might need to add
install.packages("cmdstanr", repos=c(stan="https://mc-stan.org/r-packages/",CRAN="https://cloud.r-project.org/")) to your readme file.

There apparently also is some setup needed for cmdstanr as I'm getting 5 failures in the test suite:

==> devtools::test()

ℹ Testing measr
✔ | F W S  OK | Context
✔ |       188 | data-checks [1.7s]
✔ |        41 | data [0.1s]      
✖ | 1       0 | ecpe [0.4s]      
─────────────────────────────────
Error (test-ecpe.R:3:1): (code run outside of `test_that()`)
Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
Backtrace:
1. utils::capture.output(...)
     at test-ecpe.R:3:0
5. measr::measr_dcm(...)
6. measr:::create_stan_function(...)
     at measr/R/fit-dcm.R:153:2
7. cmdstanr::cmdstan_model(...)
     at measr/R/stan-utils.R:93:4
8. cmdstanr::cmdstan_version()
9. cmdstanr:::stop_no_path()
─────────────────────────────────
✔ |        17 | extract [0.5s]   
✔ |        34 | m2-methods [6.6s]
✖ | 1       0 | mcmc [0.2s]      
─────────────────────────────────
Error (test-mcmc.R:3:1): (code run outside of `test_that()`)
Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
Backtrace:
1. utils::capture.output(...)
     at test-mcmc.R:3:0
5. measr::measr_dcm(...)
6. measr:::create_stan_function(...)
     at measr/R/fit-dcm.R:153:2
7. cmdstanr::cmdstan_model(...)
     at measr/R/stan-utils.R:93:4
8. cmdstanr::cmdstan_version()
9. cmdstanr:::stop_no_path()
─────────────────────────────────
✔ |        20 | methods [41.1s]  
✔ |        42 | param-estimates [0.2s]
✔ |        67 | priors [0.5s]    
✔ |        19 | reliability [6.8s]
✖ | 3      15 | stan-scripts [2.1s]
─────────────────────────────────
Failure (test-stan-scripts.R:27:3): stan generated quantities script works
`prob_code` (`actual`) not equal to stanmodels$gqs_probs@model_code (`expected`).

lines(actual)[19:24] vs lines(expected)[19:25]
 "}"
 "generated quantities {"
 "  matrix[R,C] prob_resp_class;   // post prob of respondent R in class C"
 "  matrix[R,A] prob_resp_attr;    // post prob of respondent R master A"
+ "  "
 "  for (r in 1:R) {"
 "    row_vector[C] prob_joint;"
 "    for (c in 1:C) {"

lines(actual)[32:37] vs lines(expected)[33:39]
 "      prob_joint[c] = log_Vc[c] + sum(log_items);"
 "    }"
 "    prob_resp_class[r] = exp(prob_joint) / exp(log_sum_exp(prob_joint));"
 "  }"
+ ""
 "  for (r in 1:R) {"
 "    for (a in 1:A) {"
 "      row_vector[C] prob_attr_class;"

lines(actual)[40:44] vs lines(expected)[42:46]
 "      }"
 "      prob_resp_attr[r,a] = sum(prob_attr_class);"
 "    }"
- "  }"
+ "  } "
 "}"

Failure (test-stan-scripts.R:35:3): stan generated quantities script works
`ppmc_code` (`actual`) not equal to stanmodels$gqs_ppmc@model_code (`expected`).

lines(actual)[21:26] vs lines(expected)[21:27]
 "  matrix[R,C] prob_resp_class;   // post prob of respondent R in class C"
 "  matrix[R,A] prob_resp_attr;    // post prob of respondent R master A"
 "  int y_rep[N];"
 "  int r_class[R];"
+ ""
 "  for (r in 1:R) {"
 "    row_vector[C] prob_joint;"
 "    for (c in 1:C) {"

lines(actual)[34:39] vs lines(expected)[35:41]
 "      prob_joint[c] = log_Vc[c] + sum(log_items);"
 "    }"
 "    prob_resp_class[r] = exp(prob_joint) / exp(log_sum_exp(prob_joint));"
 "  }"
+ ""
 "  for (r in 1:R) {"
 "    for (a in 1:A) {"
 "      row_vector[C] prob_attr_class;"

lines(actual)[42:48] vs lines(expected)[44:51]
 "      }"
 "      prob_resp_attr[r,a] = sum(prob_attr_class);"
 "    }"
- "  }"
+ "  } "
+ ""
 "  for (r in 1:R) {"
 "    vector[C] r_probs = exp(log_Vc) / exp(log_sum_exp(log_Vc));"
 "    r_class[r] = categorical_rng(r_probs);"

Failure (test-stan-scripts.R:45:3): stan log_lik script works
`loglik_code` (`actual`) not equal to stanmodels$gqs_loglik@model_code (`expected`).

lines(actual)[18:23] vs lines(expected)[18:24]
 "  matrix[I,C] pi;"
 "}"
 "generated quantities {"
 "  vector[R] log_lik;"
+ ""
 "  for (r in 1:R) {"
 "    row_vector[C] prob_joint;"
 "    for (c in 1:C) {"
─────────────────────────────────
✔ |        14 | stan-utils       
✔ |         2 | utils-display    
✔ |        11 | utils-priors     
✔ |         6 | utils [0.1s]     

══ Results ══════════════════════
Duration: 60.6 s

[ FAIL 5 | WARN 0 | SKIP 0 | PASS 476 ]

from measr.

wjakethompson avatar wjakethompson commented on June 6, 2024

Ah, yes. I don't have installation instructions for cmdstanr because it is not strictly required. By default, measr will use the rstan package as a backend to estimate models, because the cmdstanr package is not yet on CRAN. Thus, cmdstanr is optional, but I've included tests to ensure that cmdstanr works, if the user has it installed and chooses to use it. I've opened another issue (#23) to track adding more installation instructions to the package vignettes. For now, this code should get everything working for you:

install.packages("remotes")
remotes::install_github("stan-dev/cmdstanr")
cmdstanr::install_cmdstan()

from measr.

ralmond avatar ralmond commented on June 6, 2024

from measr.

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.