harrelfe / rmsb Goto Github PK
View Code? Open in Web Editor NEWRegression Modeling Strategies Bayesian
Regression Modeling Strategies Bayesian
The rmsb package fails to build on NixOS with the error
Error in loadNamespace(x) : there is no package called 'rstantools'
I traced it back to the call in ./configure. It looks like rstantools should be listed in the "LinkingTo" section of the DESCRIPTION file, as it's required to build the package.
It seems that the code in:
Lines 680 to 684 in 741eece
needs to be updated to avoid the repetitive warning:
Warning message:
“'survival::survConcordance.fit' is deprecated.
Use 'concordancefit' instead.
See help("Deprecated")”
I found several possible bugs while using the functions of the new rmsb package. I report the first one, summary(fit) or plot(summary(fit) does not seem to work in this example.
Please check and see what you can do. Thank you.
library(rms)
#> Loading required package: Hmisc
#> Loading required package: lattice
#> Loading required package: survival
#> Loading required package: Formula
#> Loading required package: ggplot2
#>
#> Attaching package: 'Hmisc'
#> The following objects are masked from 'package:base':
#>
#> format.pval, units
#> Loading required package: SparseM
#>
#> Attaching package: 'SparseM'
#> The following object is masked from 'package:base':
#>
#> backsolve
library(Hmisc)
library(rmsb)
#> Warning: package 'rmsb' was built under R version 4.1.0
DAT<-readRDS("C:/Users/Alberto/Desktop/caterina bayes/datos", refhook = NULL)
DAT$RR_PAC5<-DAT$RR_PAC4
DAT$RR_PAC5[DAT$RR_PAC5==1]<-0
DAT$RR_PAC5[DAT$RR_PAC5==2]<-1
DAT$RR_PAC5[DAT$RR_PAC5==3]<-2
DAT$RR_PAC5<-factor(DAT$RR_PAC5)
dd<-datadist(DAT)
options(datadist='dd')
bsix2 <- blrm(HE6 ~ cir * rcs(Age,3)+ linf+ RR_PAC5 + Esquema2+Estadio3 + pol(EORTC),
~ pol(EORTC), cppo=function(y) y, data=DAT, file='C:/Users/Alberto/Desktop/caterina bayes/mod_finalint.rds')
bsix2
#> Frequencies of Missing Values Due to Each Variable
#> HE6 cir Age linf RR_PAC5 Esquema2 Estadio3 EORTC
#> 0 0 0 0 0 0 0 2
#>
#> Constrained Partial Proportional Odds Ordinal Logistic Model
#>
#> blrm(formula = HE6 ~ cir * rcs(Age, 3) + linf + RR_PAC5 + Esquema2 +
#> Estadio3 + pol(EORTC), ppo = ~pol(EORTC), cppo = function(y) y,
#> data = DAT, file = "C:/Users/Alberto/Desktop/caterina bayes/mod_finalint.rds")
#>
#>
#> Frequencies of Responses
#>
#> 0 8.3 16.7 25 33.3 41.7 50 58.3 66.7 75 83.3 91.7 100
#> 5 1 4 1 9 2 43 18 35 20 48 8 23
#>
#>
#> Mixed Calibration/ Discrimination Rank Discrim.
#> Discrimination Indexes Indexes Indexes
#> Obs217 LOO log L-458.6+/-12.05 g 1.15 [0.896, 1.414] C 0.651 [0.629, 0.671]
#> Draws4000 LOO IC 917.2+/-24.1 gp 0.228 [0.188, 0.269] Dxy 0.301 [0.258, 0.342]
#> Chains4 Effective p27.62+/-2.08 EV 0.177 [0.119, 0.23]
#> p 13 B 0.214 [0.203, 0.225] v 1.18 [0.634, 1.712]
#> vp 0.042 [0.029, 0.055]
#>
#> Mode Beta Mean Beta Median Beta S.E. Lower Upper
#> cir=1 -0.3048 -0.2117 -0.2311 2.5772 -5.4525 4.6297
#> Age 0.0781 0.0814 0.0810 0.0422 -0.0042 0.1628
#> Age' -0.1145 -0.1195 -0.1186 0.0529 -0.2267 -0.0194
#> linf 0.2816 0.2868 0.2916 0.3336 -0.3699 0.9325
#> RR_PAC5=1 -0.5909 -0.5951 -0.5896 0.3487 -1.2717 0.0925
#> RR_PAC5=2 -0.7137 -0.7289 -0.7364 0.3644 -1.4355 -0.0187
#> Esquema2 -0.0156 -0.0222 -0.0305 0.3128 -0.6002 0.6123
#> Estadio3=1 0.0299 0.0286 0.0284 0.3145 -0.5739 0.6349
#> Estadio3=2 -0.3872 -0.4075 -0.4141 0.5537 -1.5124 0.6412
#> EORTC 0.2385 0.2528 0.2524 0.0980 0.0573 0.4420
#> EORTC^2 -0.0013 -0.0014 -0.0014 0.0007 -0.0028 -0.0001
#> cir=1 * Age -0.0077 -0.0100 -0.0097 0.0550 -0.1200 0.0943
#> cir=1 * Age' 0.0103 0.0139 0.0117 0.0723 -0.1251 0.1555
#> EORTC x f(y) 0.0686 0.0800 0.0776 0.0558 -0.0266 0.1880
#> EORTC^2 x f(y) -0.0003 -0.0004 -0.0004 0.0004 -0.0012 0.0003
#> Pr(Beta>0) Symmetry
#> cir=1 0.4655 1.02
#> Age 0.9755 1.08
#> Age' 0.0092 0.96
#> linf 0.8090 0.98
#> RR_PAC5=1 0.0460 1.01
#> RR_PAC5=2 0.0217 1.00
#> Esquema2 0.4622 0.99
#> Estadio3=1 0.5370 1.04
#> Estadio3=2 0.2260 1.01
#> EORTC 0.9955 1.00
#> EORTC^2 0.0190 1.02
#> cir=1 * Age 0.4298 0.97
#> cir=1 * Age' 0.5700 1.03
#> EORTC x f(y) 0.9290 1.12
#> EORTC^2 x f(y) 0.1668 0.88
summary(bsix2) # not working
#> Error in xd %*% beta: argumentos no compatibles
plot(summary(bsix2)) # not working
#> Error in xd %*% beta: argumentos no compatibles
´´´
I have problems to install the package with this error:
> install.packages("C:/Users/Alberto/Desktop/caterina/rmsb_current.zip", repos = NULL, type = "win.binary")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Alberto/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open compressed file 'rmsb_current/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : no se puede abrir la conexión
I can install it when I change the name by removing _current
But then I obtain:
> install.packages("C:/Users/Alberto/Desktop/caterina/rmsb.zip", repos = NULL, type = "win.binary")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Alberto/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
package ‘rmsb’ successfully unpacked and MD5 sums checked
> library(rmsb)
Error: package or namespace load failed for ‘rmsb’ in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Users/Alberto/Documents/R/win-library/3.6/rmsb/libs/x64/rmsb.dll':
LoadLibrary failure: No se puede encontrar el módulo especificado.
Además: Warning message:
package ‘rmsb’ was built under R version 4.1.0
Please help !
The predict.blrm function will only let you supply one of kint and ycut, which in of itself is not much of a restriction.
However, the Predict() helper function will always supply both - preventing it from working with blrm fits.
Example
getHdata(titanic3)
dd <- datadist(titanic3); options(datadist='dd')
f <- blrm(age~fare, data=titanic3)
#Works
Predict(f, fare=1000)
#Doesn't work
Predict(f, fare=1000, kint=1)
#Works
predict(f, data.frame(fare=1000), kint=1)
#For reference - doesn't work
predict(f, data.frame(fare=1000), kint=1, ycut=1)
I attempted to install from source on Windows 10 using R 4.02 running in RStudio Preview v.1073 and rtools installed.
Fails with compilation failed error:
...
C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o rmsb.dll tmp.def RcppExports.o stanExports_lrmconppo.o stanExports_lrmcppo.o -LC:/PROGRA~1/R/R-4.0.2/library/RcppParallel/lib/x64 -ltbb -ltbbmalloc -LC:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64 -Wl,-rpath,C:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64 -ltbb -ltbbmalloc -LC:/PROGRA~1/R/R-4.0.2/bin/x64 -lR
g++.exe: error: Files/R/R-4.0.2/library/RcppParallel/lib/x64: No such file or directory
no DLL was created
ERROR: compilation failed for package 'rmsb'
* removing 'C:/Program Files/R/R-4.0.2/library/rmsb'
Warning in install.packages :
installation of package ‘rmsb’ had non-zero exit status
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2
I send a reproducible example showing negative probabilities. This occurs when one of the 'y' levels is rare, and the predictor has an extreme value in its range, so I have been slow to notice the problem.
set.seed(836)
data<- data.frame(HE6=sample(1:10, 200, replace = TRUE, prob=c(rep(0.1,6),0.01,0.002,0.19,0.198) ),
Age = sample(1:85, 200, replace = TRUE), EORTC = sample(1:100, 200, replace = TRUE),
linf=rbinom(200, 1,.5),
cir=rbinom(200, 1,.5),esquema=rbinom(200, 1,.5), riesgo=factor(rbinom(200, 2,.5)), estadio=factor(rbinom(200, 2,.5)))
head(data)
table(data$HE6)
dd<-datadist(data)
options(datadist='dd')
bsx <- blrm(HE6 ~ cir*rcs(Age,3)+ linf+ pol(EORTC)+esquema+estadio+riesgo,
~ rcs(Age,3)+ pol(EORTC), cppo=function(y) y, data=data)
newdata <- data.frame(cir=0, Age=85, EORTC= 10, linf=0, riesgo=0, esquema=1, estadio=1)
predict(bsx, newdata, type='fitted.ind') #
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.