A repository of programs, scripts, and tips essential to
genetic epidemiology, statistical genetics, and bioinformatics
Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.
Showing posts with label estimate. Show all posts
Showing posts with label estimate. Show all posts
Wednesday, June 4, 2014
Easy Forest Plots in R
Forest plots are great ways to visualize individual group estimates as well as investigate heterogeneity of effect. Most forest plot programs will display combined effect estimates and give you an indicator of whether there is evidence for heterogeneity among subgroups. Fortunately, the R metafor package makes meta-analysis and plotting forest plots relatively easy. Below is a sample R script that will combine beta and standard error estimates from an input file (input.txt) and create simple forest plots with an overall estimate as well as p-values for association and heterogeneity.
In general, the input.txt file should either
(1) Have the columns:
group - name for the study or group
beta - the log odds ratio for the effect of interest
se - the standard error for the log odds ratio estimate
or
(2) Have the columns:
group - name for the study or group
OR - odds ratio for the effect of interest
LCL - lower confidence interval for the odds ratio
UCL - upper confidence interval for the odds ratio
For the second case where you have an odds ratio and 95% confidence estimates, beta and se need to be estimated. This is done by uncommenting lines 8 and 9 of the script. Of note: due to rounding error the final forest plot may have 95% CI limits that are one digit off.
The R script that uses the metafor package as well as an example input.txt are below.
Tuesday, March 25, 2014
Calculate P-value for Linear Mixed Model in R
The lme4 R package is a powerful tool for fitting mixed models in R where you can specify fixed and random effects. One oddity about the program is it returns t statistics, but no p-value. To get the p-value takes a little extra coding. Here is a quick example for fitting a linear mixed model in R (using lmer) and then the added code to calculate p-values from the t statistic. Either p1 or p2 are acceptable p-values to use.
Tuesday, February 18, 2014
Where to Find 2014 Cancer Statistics and Estimates
With cancer accounting for approximately 1 in 4 US deaths it is important to know a good resource for cancer-related statistics. Luck for us, the 2014 Cancer Facts and Figures has just been released by the American Cancer Society. This is an excellent resource on the distribution of cancer by age, sex, race, type, and geographic location in the United States. It includes cancer specific information on new cases, deaths, signs and symptoms, risk factors, prevention, early detection, treatment, and survival. This is a wonderful, up-to-date resource for getting cancer-related estimates on prevalence, incidence, mortality, and survival in the US as well as look at trends and statistics from years past. In addition, the website includes a wealth of other resources including tables, slides, and figures that are handy visual aids for presentations.
Subscribe to:
Posts (Atom)

