# load care library
library("care")
# diabetes data
data(efron2004)
x = efron2004$x
y = efron2004$y
n = dim(x)[1]
p = dim(x)[2]
# empirical regression coefficients
fit = fitlm(x, y, estimator="empirical")
fit
# t scores corresponding to partial correlations
df = n-p-1
r = fit$pcor
t = r * sqrt(df/(1-r^2))
t.pval = 2 - 2 * pt(abs(t), df)
cbind(fit$b, t, t.pval)
# compare results with lm
summary(lm(y ~ x))
Run the code above in your browser using DataLab