The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
A stuctured profile likelihood algorithm for the logistic fixed effects model and an approximate expectation maximization (EM) algorithm for the logistic mixed effects model.
You can install the released version of FEprovideR from Github with:
install.packages("devtools") # you need devtools to install packages from Github
::install_github("umich-biostatistics/FEprovideR") devtools
You can install directly from CRAN with:
install.packages("FEprovideR")
This tutorial simulates a data set to demonstrate the functions provided by FRprovideR.
# load the package
library(FEprovideR)
# other imports
library(Matrix)
library(poibin)
library(ggplot2)
To simulate a data set, use the following code chunk:
# Simulate a data set
<- 500
m <- pmax(round(rnorm(m, 50, 15)),11)
prov.size <- rnorm(m, log(3/7), 0.4)
gamma <- c(1,0.5,-1)
beta <- 'Y'
Y.char <- 'prov.ID'
prov.char <- paste0('z', 1:length(beta))
Z.char <- function(m, prov.size, gamma, beta, Y.char, Z.char, prov.char) {
sim.fe.prov <- sum(prov.size) # total number of discharges
N <- rep(gamma, times=prov.size)
gamma.dis <- rep(1:m, times=prov.size) # provider IDs
prov <- matrix(rnorm(N*length(beta)), ncol=length(beta))
Z <- rbinom(N, 1, plogis(gamma.dis+Z%*%beta))
Y <- as.data.frame(cbind(Y, prov, Z))
data colnames(data) <- c(Y.char, prov.char, Z.char)
return(data)
}<- sim.fe.prov(m, prov.size, gamma, beta, Y.char, Z.char, prov.char) data
This data is also available in the included data sets that come with the package. To use the included data, run:
data(hospital) # raw data
data(hospital_prepared) # processed data
Now, set relevant parameters and fit a model to the prepared data:
# a small positive number specifying stopping criterion of Newton-Raphson algorithm
<- 1e-5
tol # Name input variables and other parameters
<- 'Y'
Y.char <- 'prov.ID'
prov.char <- paste0('z', 1:3)
Z.char data(hospital_prepared) # build in data set
<- fe.prov(hospital_prepared, Y.char, Z.char, prov.char, tol) # model fitting fe.ls
Conduct hypothesis tests on the estimated standardized readmission ratios (SSRs):
# hypothesis testing
<- "median"
null <- 10000
n <- 0.05
alpha <- test.fe.prov(hospital_prepared, fe.ls, Y.char, Z.char, prov.char, test="score", null, alpha)
score.fe <- test.fe.prov(hospital_prepared, fe.ls, Y.char, Z.char, prov.char, test="exact.poisbinom", null, alpha)
exact.pb <- test.fe.prov(hospital_prepared, fe.ls, Y.char, Z.char, prov.char, test="exact.bootstrap", null, alpha, n)
exact.bs <- test.fe.prov(hospital_prepared, fe.ls, Y.char, Z.char, prov.char, test="exact.binom", null="median", alpha) exact.binom
Compute confidence intervals for the estimated SSRs:
# confidence intervals
<- confint.fe.prov(fe.ls, parm = "all", level = 0.88, hospital_prepared, Y.char, Z.char, prov.char)
confint.df <- confint.fe.prov(fe.ls, parm = "all", level = 0.90, hospital_prepared, Y.char, Z.char, prov.char)
confint.df <- confint.fe.prov(fe.ls, level = 0.90, data = hospital_prepared, Y.char = Y.char, Z.char = Z.char, prov.char = prov.char)
confint.df
# CIs for a subset of providers
<- confint.fe.prov(fe.ls, hospital_prepared, Y.char, Z.char, prov.char, parm=c(1,2,50), level=0.95) confint.df3
# format input data for funnel plot
<- data.frame(ID=hospital_prepared[hospital_prepared$included==1, prov.char],
input.dis prob=fe.ls$Exp)
<- data.frame(SRR=fe.ls$df.prov$SRR, flag=score.fe$flag) input.prov
Score test based funnel plot:
<- c(1)
target <- c(0.1, 0.5, 0.01)
alphas <- data.frame(SRR=fe.ls$df.prov$SRR, flag=score.fe$flag)
input.prov funnel.SRR(input.dis, input.prov, target, alphas, type="FE.score")
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.