You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jo,
The devel version of survHE (which you can download and install from this GitHub repo https://github.com/giabaio/survHE/tree/devel) does allow the use of the "weights" and "subset" options, which are already available in flexsurv.
For example, using that version of survHE and the default example dataset loaded up when you load the package, you can do
library(survHE)
m=fit.models(Surv(time,censored)~as.factor(arm), data=data, distr="wei", weights=data$sex+1, subset=data$ethnic==1)
m
Model fit for the Weibull AF model, obtained using Flexsurvreg
(Maximum Likelihood Estimate). Running time: 0.036 seconds
mean se L95% U95%
shape 1.906546 0.215962 1.5269624 2.380490
scale 9.293372 1.041126 7.4612937 11.575307
as.factor(arm)1 0.402658 0.156897 0.0951459 0.710171
Model fitting summaries
Akaike Information Criterion (AIC)....: 321.547
Bayesian Information Criterion (BIC)..: 328.161
which produces the analysis using the variable sex (originally coded as 0/1 --- that's why I add 1 in the call to fit.models). Note that unless you attach the data, you need to refer to the variables using the "$" notation (so data$sex).
We haven't implemented the weighted versions under a Bayesian analysis (though I think this should be already fairly straightforward and possibly doable without fiddling with survHE under the INLA method). We can include that as part of the development targets, but it's not a top priority right now (unless we have more requests/urgency).
Note also that, in theory, you can create the weighted version of the variables "externally" and then pass the weighted dataset to the "normal" call to survHE --- that should also work...
Hi Gianluca,
Thanks for the great package!
I was wondering if there was a way to add weights to fit.models.
Thanks,
Jo
The text was updated successfully, but these errors were encountered: