84 Matching Annotations
  1. Mar 2025

    Annotators

    Annotators

    1. ggplot(regicor, aes(x=age, y=sbp))+ theme_bw() + geom_point() + xlab("Age") + ylab("Systolic blood pressure")+ geom_smooth(method='lm', formula= y~x)

      2 columnas aquí también para que no tengas múltiples instrucciones en la misma línea y el theme_bw() en último para seguir el orden de ideas que explicó Pau

    2. library(ggplot2) ggplot(regicor, aes(x=age, y=sbp))+ geom_point() + xlab("Age") + ylab("Systolic blood pressure") + theme_bw()

      para que se vea mejor usaría 2 columnas. Una con el código y otra con el plot

    Annotators

    1. **13.** Given last model, plot the predicted probabilities of diabetes according to glucose and BMI. ::: {.cell} ```{.r .cell-code} df$pred <- predict(m5, type="response", data=df) library(ggplot2) ggplot(df, aes(x = glucose, y = pred, color = bmi_cat)) + geom_smooth(se = FALSE) + theme_bw()+ ylab("Predicted probability of diabetes") + xlab("Glucose") + # Add lab to x-axis labs(color = "Obese") + # Change legend title theme(legend.position = "top") # Move legend to the top

      Pasa algo con el formato del código

    2. m5 <- glm(diabetes ~ glucose + bmi_cat + age, data=df, family=binomial) m5 |> tbl_regression(exponentiate=T)

      Lo mismo que antes. Solución con el enunciado

    Annotators

    1. results_anova_rm$term<-c("Group","Residuals","Time","Residual") names(results_anova_rm)<-c("Stratum","Term","df","SS","MSQ","F","P-value")

      Aquí lo mismo de antes:

      results_anova_2w <- broom::tidy(model_anova_2w)

      results_anova_2w <- results_anova_2w |> mutate(term = c("Between-groups: Dose","Between-groups: Supp","Interaction","Within-groups")) |> setNames(c("Terms","df","SS","MSQ","F","P-value"))

    2. as.data.frame(emm) |> ggplot(aes(x = dose, y = emmean, color = supp, group = supp)) +

      lo mismo, mejor poner:

      ggplot(as.data.frame(emm), aes(x = dose, y = emmean, color = supp, group = supp))

    3. results_anova_2w <- broom::tidy(model_anova_2w) results_anova_2w$term<-c("Between-groups: Dose","Between-groups: Supp","Interaction","Within-groups") names(results_anova_2w)<-c("Terms","df","SS","MSQ","F","P-value")

      esto va a ser un poco friky, pero lo han aprendido de la siguiente forma:

      results_anova_2w <- broom::tidy(model_anova_2w)

      results_anova_2w <- results_anova_2w |> mutate(term = c("Between-groups: Dose","Between-groups: Supp","Interaction","Within-groups")) |> setNames(c("Terms","df","SS","MSQ","F","P-value"))

      he usado el setNames para que no te ocupe 50 líneas con el rename() pero es importante decir que hace el cambio de nombres por posición de cada columna

    4. as.data.frame(emm) |> ggplot( aes(x = dose, y = emmean, ymin = lower.CL, ymax = upper.CL))

      se van a liar con esto porque mezcla pipes con el "+" del ggplot, mejor:

      ggplot(as.data.frame(emm), aes(x = dose, y = emmean, ymin = lower.CL, ymax = upper.CL))

    Annotators

    1. Check the age of the 20th subject. Find the values of the age that are greater than 100.

      Check the age: a) for the 20th subject b) Find the values greater than 100

    2. Check the structure of the data. What class is the object? What class are the vectors stored in its columns? How many rows and columns does the data have?

      Quizás poner cada punto como diferentes ejercicios: a) What class.... b) ... c)

    3. From the database, filter and select the database that contains the ID, age, sex, and time to exitus of the patients, sorted by time to exitus.

      Filter the database created in Exercise 12 according to the previous condition and select the columns containing ID, age, sex and time to exitus of the patients. Then sort it by time to exitus.

    Annotators

    Annotators

    1. From the database, filter and select the database that contains the ID, age, sex, and time to exitus of the patients, sorted by time to exitus.

      Filter the database created in Exercise 12 according to the previous condition and select the columns containing ID, age, sex and time to exitus of the patients. Then sort it by time to exitus.

    2. Check the structure of the data. What class is the object? What class are the vectors stored in its columns? How many rows and columns does the data have?

      Quizás poner cada punto como diferentes ejercicios: a) What class.... b) ... c)

    Annotators