library(tidyverse)
[30m-- [1mAttaching packages[22m --------------------------------------- tidyverse 1.2.1 --[39m
[30m[32mv[30m [34mggplot2[30m 2.2.1 [32mv[30m [34mpurrr [30m 0.2.4
[32mv[30m [34mtibble [30m 1.4.2 [32mv[30m [34mdplyr [30m 0.7.4
[32mv[30m [34mtidyr [30m 0.8.0 [32mv[30m [34mstringr[30m 1.3.0
[32mv[30m [34mreadr [30m 1.1.1 [32mv[30m [34mforcats[30m 0.3.0[39m
[30m-- [1mConflicts[22m ------------------------------------------ tidyverse_conflicts() --
[31mx[30m [34mdplyr[30m::[32mfilter()[30m masks [34mstats[30m::filter()
[31mx[30m [34mdplyr[30m::[32mlag()[30m masks [34mstats[30m::lag()[39m
df <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vQe0XfZC0FSB9_Z66X2izmOJIuycFnOPgJ9gyGQslc2_DWVX-sNlYAy15U61mnOaYN5U2Hiy180c1CH/pub?gid=1770317394&single=true&output=csv")
Parsed with column specification:
cols(
.default = col_character(),
Edad = col_integer(),
HbA1c = col_double(),
`Cantidad de cigarrillos al d攼㹤a.` = col_integer(),
COPD = col_integer(),
C = col_integer(),
O = col_integer(),
P = col_integer(),
CPITN = col_integer(),
S1 = col_integer(),
S2 = col_integer(),
S3 = col_integer(),
S4 = col_integer(),
S5 = col_integer(),
S6 = col_integer(),
TOTAL = col_integer()
)
See spec(...) for full column specifications.
Selecciono solo aquellas columnas que voy a dejar
rr df <- df %>% select(edad, Sexo, COPD, CPITN, PREGUNTA 1:TOTAL )
Error in FUN(X[[i]], ...) : object 'edad' not found
Este gráfico muestra que existe una relación lineal directa entre la pérdida dentaria insatisfacción con la calidad de vida relacionada con la salud oral, hasta cuando las personas tienene un COPD de 20. Luego de eso, al parecer las personas o se acostumbran o comienzan a utilizar protesis y la calidad de vida relacionada con salud oral mejora.
El CPITN se asocia a una peror calidad de vida relacionada con salud oral al pasar de 2 a 3
summary(modelo1)
Call:
lm(formula = TOTAL ~ Edad + COPD + CPITN, data = df)
Residuals:
Min 1Q Median 3Q Max
-2.9241 -2.0870 -0.7179 1.6215 9.7618
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.14496 3.33327 -0.343 0.7345
Edad 0.01799 0.06038 0.298 0.7685
COPD 0.05501 0.11297 0.487 0.6311
CPITN 1.39479 0.53077 2.628 0.0154 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.19 on 22 degrees of freedom
Multiple R-squared: 0.2528, Adjusted R-squared: 0.1509
F-statistic: 2.481 on 3 and 22 DF, p-value: 0.08765
stargazer::stargazer(modelo1, modelo2, modelo3, type="text",
dep.var.labels = "Calidad de vida relacionada con la salud oral",
ci = TRUE, ci.level = 0.95,
intercept.bottom = FALSE)
length of NULL cannot be changedlength of NULL cannot be changedlength of NULL cannot be changedlength of NULL cannot be changedlength of NULL cannot be changednumber of rows of result is not a multiple of vector length (arg 2)
=================================================================================
Dependent variable:
-------------------------------------------------------------
Calidad de vida relacionada con la salud oral
(1) (2) (3)
---------------------------------------------------------------------------------
Constant -1.145 -0.504 1.409
(-7.678, 5.388) (-5.393, 4.386) (-1.328, 4.145)
Edad 0.018
(-0.100, 0.136)
COPD 0.055 0.077
(-0.166, 0.276) (-0.086, 0.240)
CPITN 1.395** 1.420** 1.255**
(0.355, 2.435) (0.414, 2.426) (0.315, 2.196)
---------------------------------------------------------------------------------
Observations 26 26 26
R2 0.253 0.250 0.222
Adjusted R2 0.151 0.185 0.189
Residual Std. Error 3.190 (df = 22) 3.126 (df = 23) 3.116 (df = 24)
F Statistic 2.481* (df = 3; 22) 3.829** (df = 2; 23) 6.841** (df = 1; 24)
=================================================================================
Note: *p<0.1; **p<0.05; ***p<0.01