Hi am doing logistic regression in R and i want to know if i can stock the regression result like coef, std, p-value in a table like on SAS. I have the result but as in the next image i dont want this kind of présentation.
Thanks
Hi am doing logistic regression in R and i want to know if i can stock the regression result like coef, std, p-value in a table like on SAS. I have the result but as in the next image i dont want this kind of présentation.
Thanks
There are lots of packages to do this in R, actually. While you could certainly do it manually (selecting each element you want), it's a common enough task that several have presets to do what I think you want (I'm not a SAS user, so I don't know exactly what their tables look like).
If you're using R Markdown it will depend a bit on what output type you want. The Hmisc package does very nice summaries http://biostat.mc.vanderbilt.edu/wiki/Main/Hmisc.
There's a blog post (see link below) with examples from a package called finalfit
The sjPlot package does nice model summary tables as HTML:
http://www.strengejacke.de/sjPlot/articles/sjtlm.html
# load package
library(sjPlot)
#> Install package "strengejacke" from GitHub (`devtools::install_github("strengejacke/strengejacke")`) to load all sj-packages at once!
library(sjmisc)
library(sjlabelled)
# sample data
data("efc")
efc <- as_factor(efc, c161sex, c172code)
efc$neg_c_7d <- ifelse(efc$neg_c_7 < median(efc$neg_c_7, na.rm = TRUE), 0, 1)
m4 <- glm(
neg_c_7d ~ c161sex + barthtot + c172code,
data = efc,
family = binomial(link = "logit")
)
tab_model(m4, show.se = TRUE, show.std = TRUE, show.stat = TRUE)
neg c 7 d |
|||||||
---|---|---|---|---|---|---|---|
Predictors |
Odds Ratios |
std. Error |
std. Beta |
CI |
standardized CI |
Statistic |
p |
(Intercept) |
6.54 |
0.30 |
-0.37 |
3.66 – 11.96 |
-0.80 – 0.06 |
-1.69 |
0.09 |
carer’s gender: Female |
1.87 |
0.18 |
0.63 |
1.31 – 2.69 |
0.27 – 0.99 |
3.40 |
0.00 |
Total score BARTHEL INDEX |
0.97 |
0.00 |
-1.03 |
0.96 – 0.97 |
-1.22 – -0.85 |
-10.72 |
0.00 |
carer’s level of |
1.23 |
0.20 |
0.21 |
0.84 – 1.82 |
-0.18 – 0.60 |
1.06 |
0.29 |
carer’s level of |
1.37 |
0.25 |
0.31 |
0.84 – 2.23 |
-0.17 – 0.80 |
1.27 |
0.20 |
Observations |
815 |
||||||
R2 Tjur |
0.191 |
Created on 2019-11-21 by the reprex package (v0.3.0.9001)
See also the post here:
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.