Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended calculation to determine box sizes of point estimates #37

Open
TACdeVries opened this issue Feb 28, 2023 · 5 comments
Open

Comments

@TACdeVries
Copy link

Dear Adayim/all,

Is there a recommended formula to determine the box sizes of the point estimates based on weights as used in meta-analytic models?

My best attempt so far is dividing the weight (in %) by 10 and taking the square root hereof. This results in values roughly between 0.5 and 1.5 and looks reasonable while still being proportional to the study weight. However, I don't want to give the wrong impression and would prefer a 'standard' method.

Does anyone know what the 'usual' formula is to determine the size? Or are there other suggestions to determine the box sizes based on weight?

Thanks,
Tim

@TACdeVries
Copy link
Author

TACdeVries commented Feb 28, 2023

Dear all,

I noticed a line of code in another thread. That one seems to work well after a few minor tweak. Thus, what was used was:

x <- sqrt(1/sizes)
sizes <- x/max(x)

As I am using weights which are already inversely related to the SE, I got satisfying results by using the code below. As expected this resulted in box sizes being proportional to the study weight.

sqrt(weights(model))/max(sqrt(weights(model)))

Hopefully this code is also to someone else's liking.

Best,
Tim

@adayim
Copy link
Owner

adayim commented Mar 1, 2023

Hi Tim,

Thank you for your advice. I attempted to compute a weight earlier, as you said, and I'm not sure whether I did it right. I am not an expert in meta-analysis. As a result, I deleted the weight calculating code. Another reason I'm doing so is that this package isn't only for meta-analysis. Some people may want to present the model coefficients, and this is the main reason for developing this package. They want to have different weighting methods. As a result, I have left it to the user to decide.

I have pinned this issue so others can check it out and provide some other suggestions.

Thank you very much for this.

@adayim adayim pinned this issue Mar 1, 2023
@TACdeVries
Copy link
Author

Thanks Adayim,

Looking forward to seeing suggestions of others. Maybe some are more experienced with the code underlying meta-analytic packages. I will try to contact a developer of one of the major meta-analysis packages to see if I can get a response.

@TACdeVries
Copy link
Author

I've had contact with Prof. Wolfgang, developer of the Metafor package and his method is quite similar. However, he restricts the minimum to 0.5 and maximum size to 1.5.

In a nutshell:

plim <- c(0.5, 1.5)
wi <- sqrt(weights(model))
rng <- max(wi, na.rm=TRUE) - min(wi, na.rm=TRUE) 
psize <- (wi - min(wi, na.rm=TRUE)) / rng
psize <- (psize * (plim[2] - plim[1])) + plim[1]

The exact coding used in the metafor package: weblink

   ### set default point sizes (if not specified by user)

   if (is.null(psize)) {
      if (length(plim) < 2L)
         stop(mstyle$stop("Argument 'plim' must be of length 2 or 3."))
      wi <- sqrt(weights)
      if (!is.na(plim[1]) && !is.na(plim[2])) {
         rng <- max(wi, na.rm=TRUE) - min(wi, na.rm=TRUE)
         if (rng <= .Machine$double.eps^0.5) {
            psize <- rep(1, k)
         } else {
            psize <- (wi - min(wi, na.rm=TRUE)) / rng
            psize <- (psize * (plim[2] - plim[1])) + plim[1]
         }
      }
      if (is.na(plim[1]) && !is.na(plim[2])) {
         psize <- wi / max(wi, na.rm=TRUE) * plim[2]
         if (length(plim) == 3L)
            psize[psize <= plim[3]] <- plim[3]
      }
      if (!is.na(plim[1]) && is.na(plim[2])) {
         psize <- wi / min(wi, na.rm=TRUE) * plim[1]
         if (length(plim) == 3L)
            psize[psize >= plim[3]] <- plim[3]
      }
      if (all(is.na(psize)))
         psize <- rep(1, k)
   }

@adayim adayim unpinned this issue Mar 8, 2023
@adayim
Copy link
Owner

adayim commented Apr 5, 2023

I am planning to keep this issue opened if it is OK with you. So others can see this. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants