Thank you very much for your comment. I can already amended error code in library (boot). Later, the codes can run the normal result.
Loading package "boot" (Functions for bootstrapping)
library(boot)
Creating Function to obtain R-Squared from the data
r_squared <- function(formula, data, indices) {
val <- data[indices,] # selecting sample with boot
fit <- lm(formula, data=val)
return(summary(fit)$r.square)
}
Performing 299 replications with boot
output <- boot(data=heart_failure_clinical, statistic=r_squared,
R=299, formula=DEATH_EVENT~serum_creatinine+anaemia)
Plotting the output
output
plot(output)
Obtaining a confidence interval of 95%
boot.ci(output, type="bca")
`> library(boot)
r_squared <- function(formula, data, indices) {
- val <- data[indices,] # selecting sample with boot
- fit <- lm(formula, data=val)
- return(summary(fit)$r.square)
- }
Performing 299 replications with boot
output <- boot(data=heart_failure_clinical, statistic=r_squared,
Plotting the output
output
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = heart_failure_clinical, statistic = r_squared, R = 299,
formula = DEATH_EVENT ~ serum_creatinine + anaemia)
Bootstrap Statistics :
original bias std. error
t1* 0.08919886 0.007204561 0.02901739
plot(output)
Obtaining a confidence interval of 95%
boot.ci(output, type="bca")
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 299 bootstrap replicates
CALL :
boot.ci(boot.out = output, type = "bca")
Intervals :
Level BCa
95% ( 0.0363, 0.1392 )
Calculations and Intervals on Original Scale
Some BCa intervals may be unstable`