1

I need to perform exact logistic regression for my small sample size (n = 46). I have two dependent variables (as and fof) and I will do two separate models for each. I have 17 independent variables, for example: continous(minonground,mental, ...), categorical (pdd in three groups), and some binaries(injury, multiple, ...). When I code the elrm for my dataset, I have two problems:

  1. I receive an error which cannot recognize the n variable. I do not know what is a number of binomial trials which exists in all examples up on the Internet. I have only one row per patient.

  2. What does "interest" mean when outcome variable is fof and all other variables as predictors?

My code:

library(elrm)
fit1 <- elrm(fof/n~ minonground+injury+pdd, interest = ~minonground, r=4, iter = 2000, burnIn = 100,dataset = com, alpha = 0.05)

I tried numbers instead of n but failed. In fact, I don't know what it is and how should I define it for my dataset.

Artem
  • 3,304
  • 3
  • 18
  • 41
Sasa Moin
  • 11
  • 2
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Dec 13 '22 at 18:11

1 Answers1

0

The task of the exact logistic regression is to understand which predictor is influential on the response especially for small samples. So in your case you would like to understand if minonground significant taken in consideration the influence of other variables. So you indicate interest = ~minonground as a variable of interest, all other variables in formula fof / n ~ minonground + injury + pdd however constitute model are not of interest for you, they are nuisuance parameters.

In the formula x/y means success/total so in your data set you should have the column fof with number of successes and in n column should be total number of cases (n should be column, not a number). If you have one row for each patient and observed some case then, in fof should be binary and n = 1 for each row.

So I generated some random sample based on the structure you mentioned + added n column, and you can see that minoground is not significant (p > 0.8, confidence interval includes zero, no wonder - it's just a random sample).

See below:

library(elrm)
set.seed(300)
k <- 46
com <- data.frame(
  fof = sample(0:1, k, replace = TRUE),
  n = 1,
  minonground = sample(10:15 / 10, k, replace = TRUE),
  pdd = factor(sample(letters[1:3], k, replace = TRUE)),
  injury = factor(sample(letters[1:2], k, replace = TRUE)))

fit1 <- elrm(fof / n ~ minonground + injury + pdd, interest = ~minonground,
             r = 4, iter = 2000, burnIn = 100, dataset = com, alpha = 0.05)
summary(fit1)

Output:

Call:

Call:

elrm(formula = fof/n ~ minonground + injury + pdd, interest = ~minonground, r = 4, iter = 2000, dataset = com, burnIn = 100, alpha = 0.05)


Results:

            estimate p-value p-value_se mc_size
minonground  0.05373    0.89    0.04215    1900


95% Confidence Intervals for Parameters

                lower    upper
minonground -5.202161 4.824931
Artem
  • 3,304
  • 3
  • 18
  • 41