GithubHelp home page GithubHelp logo

wdm-r's Issues

Spearman bug with weights?

Hi Thomas
I suppose there's a bug in your spearman code when using weights. From my understanding the following should hold:

# Example taken from: http://www.math.wpi.edu/saspdf/stat/chap28.pdf
# pp. 1349

library(DescTools)

Pain <- as.table(matrix(c(26, 26, 23, 18, 9, 6, 7, 9, 14, 23), 
                        nrow=5, 
                        dimnames = list(Dose = c("0", "1", "2", "3", "4"), 
                                        Adverse = c("No", "Yes")))) 

Desc(Pain, verb=3)

# consistent with the SAS results
with(Untable(Pain), cor(N(Adverse), N(Dose), method = "spearman"))
DescTools:::SpearmanRho(Pain)

# correct:
with(Untable(Pain),
     wdm::indep_test(as.numeric(Adverse), as.numeric(Dose), 
                     method = "spearman"))

# ******************************
# wrong:
with(as.data.frame(Pain),
     wdm::indep_test(as.numeric(Adverse), as.numeric(Dose), 
                     method = "spearman", weights = Freq))
# ***********************

# all correct (and consistent with SAS):
with(Untable(Pain),
     wdm::indep_test(as.numeric(Adverse), as.numeric(Dose), 
                     method = "pearson"))
with(as.data.frame(Pain),
     wdm::indep_test(as.numeric(Adverse), as.numeric(Dose), 
                     method = "pearson", weights = Freq))

with(Untable(Pain),
     wdm::indep_test(as.numeric(Adverse), as.numeric(Dose), 
                     method = "kendall"))
with(as.data.frame(Pain),
     wdm::indep_test(as.numeric(Adverse), as.numeric(Dose), 
                     method = "kendall", weights = Freq))

wrappers.cpp: fatal error: wdm.hpp: No such file or directory

Apparently it does not pass correct flags.

* installing *source* package ‘wdm’ ...
** using staged installation
** libs
/opt/local/bin/g++-mp-12 -std=gnu++11 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include   -fPIC  -pipe -Os -arch ppc  -c RcppExports.cpp -o RcppExports.o
/opt/local/bin/g++-mp-12 -std=gnu++11 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include   -fPIC  -pipe -Os -arch ppc  -c wrappers.cpp -o wrappers.o
wrappers.cpp:3:10: fatal error: wdm.hpp: No such file or directory
    3 | #include "wdm.hpp"
      |          ^~~~~~~~~
compilation terminated.
make: *** [wrappers.o] Error 1
ERROR: compilation failed for package ‘wdm’
* removing ‘/opt/local/var/macports/build/_opt_PPCRosettaPorts_R_R-wdm/R-wdm/work/.tmp/RtmpSgYHLt/Rinst8a3d603ff8f1/wdm’
      -----------------------------------
ERROR: package installation failed
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCRosettaPorts_R_R-wdm/R-wdm/work/wdm-r-0.2.3" && /opt/local/bin/R CMD build . --no-manual --no-build-vignettes 
Exit code: 1

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.