Closed petermacp closed 4 months ago
Hi – thanks for bringing to my attention.
It’s actually because penguin_data is a tibble and not a data frame. Replacing the call below to PAF_calc_discrete with
PAF_calc_discrete(penguin_model, riskfactor = "species", refval="Adelie", data=as.data.frame(penguin_data), calculation_method="D",ci=FALSE)
will work.
John
From: petermacp @.> Date: Wednesday, 12 October 2022 at 11:19 To: johnfergusonNUIG/graphPAF @.> Cc: Subscribed @.***> Subject: [johnfergusonNUIG/graphPAF] Not calculating PAFs (Issue #2) EXTERNAL EMAIL: This email originated outside the University of Galway. Do not open attachments or click on links unless you believe the content is safe. RÍOMHPHOST SEACHTRACH: Níor tháinig an ríomhphost seo ó Ollscoil na Gaillimhe. Ná hoscail ceangaltáin agus ná cliceáil ar naisc mura gcreideann tú go bhfuil an t-ábhar sábháilte.
Many thanks for this package.
I can get the example in the package to run correctly, but whenever I attempt to run PAF_calc_discrete() with alternative datasets, I always get a PAF of 0.
Here is an example with the penguins dataset, and I get a similar result for our real data with a more complex model.
Any suggestions gratefully received.
library(tidyverse)
library(palmerpenguins)
library(broom)
library(graphPAF)
penguin_data <- penguins
penguin_data <- penguin_data %>%
mutate(sex = case_when(
sex=="male" ~ 1,
sex=="female" ~0
)) %>%
drop_na()
penguin_model <- glm(sex ~ species, data=penguin_data, family="binomial")
tidy(penguin_model, exponentiate = T, conf.int = T)
PAF_calc_discrete(penguin_model, riskfactor = "species", refval="Adelie", data=penguin_data, calculation_method="D",ci=FALSE)
Created on 2022-10-12 with reprex v2.0.2https://reprex.tidyverse.org
— Reply to this email directly, view it on GitHubhttps://github.com/johnfergusonNUIG/graphPAF/issues/2, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGHOLTJ2RQD26LMOMT5AJLDWC2GEDANCNFSM6AAAAAARDEKIQE. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Brilliant! That works. thank you
Many thanks for this package.
I can get the example in the package to run correctly, but whenever I attempt to run
PAF_calc_discrete()
with alternative datasets, I always get a PAF of 0.Here is an example with the
penguins
dataset, and I get a similar result for our real data with a more complex model.Any suggestions gratefully received.
Created on 2022-10-12 with reprex v2.0.2