I've got a dataset that follows patients who underwent different treatment options for aneurysms. They can have more than one aneurysm and each may be treated differently.

So I have variables like:

Treatment1, treatment2, treatment3, where 1, 2 and 3 are different treatments.

size1, size2, size3 where the numbers identify which aneurysm, this follows:

location1, location2, etc. So location1 and size1 are connected, ie. it's aneurysm "number one" that has a specific location and size.

Then we also have adverse effect per aneurysm so adverse1, adverse2, adverse3.

I'm interested to see if aneurysm size, location and treatment option are correlated with outcome (adverse effect).

I've thought about model selection and perhaps using a mixed model would be the best here? How would you approach such a data structure?

EDIT: I believe I have the data formatted as well as I can. I have created variables explaining size and location for each aneurysm, but I'm not sure where to go from here. Let's assume you want to know, from this data, whether location of aneurysms is correlated with size. How would you about doing that? Normally I would regress size vs location but these are 5 sizes and 5 locations, one for each aneurysm.

Picture of data.

  • 1
    $\begingroup$ What do you mean by "high dimensional data" ? Please explain the dimensionality of all the variables. Can the same aneurysm in the same patient have different treatements ? $\endgroup$ – Robert Long Jul 27 at 11:48
  • 1
    $\begingroup$ Not the same aneurysm, no, but the patient may have two aneurysms and aneurysm one may have an entirely different combinations of size, location, treatment etc. than aneurysm two, even though they both connote the same patient. $\endgroup$ – Student Jul 27 at 12:08
  • $\begingroup$ What do you mean by "high dimensional data" ? Please explain the dimensionality of all the variables. $\endgroup$ – Robert Long Jul 27 at 12:09
  • $\begingroup$ The study has probably over 300 variables and only about 1000 observations due to the nature the variables are constructed. There's a variable called "size for aneurysm 1 in location A" so with 8 different locations, aneurysm1 may have a large combination of variables explaining it. I don't think running statistics on the data as is will work at all so I'm looking at methods of dimensionality reduction. $\endgroup$ – Student Jul 27 at 12:13
  • 1
    $\begingroup$ The problem I run into however is that I can't just regress "does size affect outcome" because patients have varying amounts of aneurysms and each with different sizes. $\endgroup$ – Student Jul 27 at 12:14

You don't want to be doing dimensionality reduction (as suggested in the question comments) here.

The problem is that your data are in wide format, and to analyse them with a regression model you need them in long format.

At present you appear to have 1 row per patient. What you need is 1 row per aneurysm.

You should have columns for

  1. Patient ID
  2. Aneurysm ID instead of different columns for different aneurysms
  3. Aneurysm Location instead of different columns for different aneurysm location
  4. Aneurysm Size instead of different columns for the sizes of different aneurysm.
  5. The treatment for that particular aneurysm
  6. The adverse outcome variable for that particular aneurysm

...and that's about it unless there are other variables not mentioned

So to illustrate:

PatientID AnID AnLoc AnSize Treat Adverse
1          1    A     2       1     Y
1          2    B     2       1     N
2          1    C     3       1     N
3          1    A     4       2     Y
4          1    C     3       2     N
4          2    D     2       3     Y
4          3    E     3       1     N
5          1    C     3       1     N
6          1    A     2       1     Y
7          1    A     3       2     N
7          2    B     4       2     N

[obviously I don't know the details of your data, so obviusly some combinations might not make sense but hopefully you get the idea.]

Then you would run a mixed effect model with random intercepts for patient, and aneurysm nested in patient.

Adverse ~ Treat + AnSize + AnLoc + (1|PatientID/AnID)

If there is only one measurement for each aneurysm then you don't need to include AnID

This will estimate the associations of treatment, aneurysm size and location on an adverse outcome. You might also consider inteactions between these variables.

If Advserse is binary then it should be a logistic model.

However, some care is need to ensure that you don't include mediators on the causal path - for example if location affects treatment, then you don't want to include treatment in the same model because it is a mediator and it will bias the estimate for location. Similarly if size affects treatment you would again not want to include treatment.

| cite | improve this answer | |
  • $\begingroup$ Thank you Robert, that clears it up. I guess I was on the right track with a mixed model but I got confused by not realizing that I should include several observations per patient as demonstrated in your table. $\endgroup$ – Student Jul 27 at 17:06
  • $\begingroup$ I'm glad I could help. You're welcome :) Sometimes these things are far from obvious !! $\endgroup$ – Robert Long Jul 27 at 17:08

You can try using the GLM in R like:

aneu.fact <- as.factor(data$aneurysm.sz)
loc.fact <- as.factor(data$location)
treat.fact <- as.factor(data$treatment)

glm.1 <- glm(adverse$eff ~ aneu.fact + loc.fact + treat.fact, family=poisson)

This example uses a GLM (Generalized Linear Model) with a poisson link function (more on this here).

The summary() function will output the p values for each variable regarding its' significance in response variable prediction.

If you want to select features based on their contribution to prediction, you can use the step() function in R, that in each iteration will get one feature out, and calculate several criterions for model performance.

aneu.fact <- as.factor(data$aneurysm.sz)
loc.fact <- as.factor(data$location)
treat.fact <- as.factor(data$treatment)

glm.1 <- step(glm(adverse$eff ~ aneu.fact + loc.fact + treat.fact, family=poisson))

If you want to account for random effects inside the features, you can use the lmer() function of the lme4 package, and account for that by the ((1|feature) syntax):

aneu.fact <- as.factor(data$aneurysm.sz)
loc.fact <- as.factor(data$location)
treat.fact <- as.factor(data$treatment)

glme.1 <- glmer(adverse$eff ~ (1|aneu.fact) + loc.fact + treat.fact), family = poisson)


| cite | improve this answer | |
  • 2
    $\begingroup$ This would not account for repeated measures within patients or repeaated measures within aneurysm $\endgroup$ – Robert Long Jul 27 at 13:48
  • 1
    $\begingroup$ I see you've updated your answer. Why do you have a poisson GLM but not a poisson mixed model ? And why would it be poisson ? I didn't see anything in the question about the outcome being a count variable. And your model formula for lmer doesn't make sense. At the very least there should be random intercepts for patient. $\endgroup$ – Robert Long Jul 27 at 14:44
  • $\begingroup$ You are right. Corrected that, thanks. $\endgroup$ – Michael Sidoroff Jul 27 at 15:59
  • $\begingroup$ You now have random intercepts for aneu.fac but there are no repeated measures within aneu.fac. You need random intercepts for patient. You haven't justified why a Poisson model is appropriate (the response is not a count). And please don't recommend stepwise procedures, they are worthless) $\endgroup$ – Robert Long Jul 27 at 19:06
  • $\begingroup$ Well, thanks for your comments. Can you please elaborate your statement about stepwise procedures being "worthless"? $\endgroup$ – Michael Sidoroff Jul 27 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.