Monday, September 19, 2011

How to get orthogonal polynomial coefficient/vector/codes

Tips - R & Stata & SAS: How to get orthogonal polynomial coefficient/vector/codes

When we do "contrast {lvl #1 #2 #3}" for trend analyses using Stata or other software for unequally spaced levels/categories, we need the orthogonal polynomial coefficient (#1 #2 #3), which is hard to be find in books. We can get these coefficients using R, Stata, or SAS. My favorite software for this purpose is R. Below I show the examples using these different kinds of software. Note: Stata has an operator (p. for orthogonal polynomial in the level values) for unequally spaced levels, for example, "contrast p.lvl".

R
  mostly I use R to get these coefficients:
  >cntr<-poly(c(1,2,5,6),3)
  >cntr

Stata
Step 1: create a dataset with one variable [lvl]:
  .input lvl
  1. 1
  2. 2
  3. 5
  4. 6
  5. end
Step 2-b: use 'orthpoly'
  .orthpoly lvl, generate(cntr1 cntr2 cntr3) degree(3)

  Now, in the dataset, you can find three new variables 'cntr1' for the orthogonal polynomial coefficients of degree 1 (linear), and 'cntr2' for the orthogonal polynomial coefficients of degree 2 (quadratic), and 'cntr3' for the orthogonal polynomial coefficients of degree 3 (cubic).

SAS
  PROC IML;
   lvl = {1 3 5 6}
   cntrl=ORPOL(lvl);
   PRINT cntrl;
  QUIT;

Friday, September 16, 2011

Tips: Stata - my first Stata program

capture program drop tabm
 program tabm
   version 12
   syntax varlist [if][in],cell count column row se ci ///

          cv percent proportion]
   local varnum : word count `varlist'
   local x : word 1 of `varlist'
   forvalues i=2/`varnum' {
       local y: word `i' of `varlist'
       svy: tabulate `x' `y',`col' `cell' `se' `percent' ///

            format(%5.1f)
  }
end


.tabm sex race5grp diabetes,cell se percent

why I get error message, when using 'margins' for complex sampling data

Tips - Stata: why I get error message, when using 'margins' for complex sampling data

When I use 'margins' for complex sampling data, after a logistic regression:
  . svy, subpop(if suball==1): logit arthritis i.diabetes c.age i.sex i.bmi4grp
  . margins diabetes, vce(unconditional) post

I've got an error message sometime:
  "missing predicted values encountered within the estimation sample r(322)"


The answer is to include 'subpop' in the 'margins' command:
  .margins diabetes, subpop(if suball==1) vce(unconditional) post

HbA1c: what do the numbers really mean?
The Lancet, Volume 378, Issue 9796, Pages 1068 - 1069, 17 September 2011
The Comment by Shivani Misra and colleagues (April 30, p 1476)1 addresses the topic of changing the way glycated haemoglobin (HbA1c) is reported from the traditional percentage units (used in the Diabetes Control and Complications Trial [DCCT] and UK Prospective Diabetes Study [UKPDS]) to the International Federation of Clinical Chemistry's (IFCC's) mmol/mol units. This is an important communication. Unfortunately, the Comment contains both misleading and erroneous information.
The remark about “variations of between 3% and 14% being reported” is misleading. The paper cited refers to between-laboratory coefficients of variation obtained from old (1996) data, before implementation of method standardisation by the National Glycohemoglobin Standardization Program (NGSP). Virtually all current methods have coefficients of variation of 5% or less, with some less than 2%.2
Moreover, Misra and colleagues advise clinicians not to convert the IFCC mmol/mol results to DCCT-aligned percentage units and claim that “the DCCT-aligned results are now untraceable and cannot be linked… to the original reference measurement, making them effectively meaningless”. This statement is completely incorrect. An established master equation with documented stability, which describes a linear relation between IFCC and NGSP/DCCT units, permits traceability of DCCT results to the IFCC reference system, and allows direct conversion of numbers between the two systems.3 This is vital to allow health-care providers to compare a patient's HbA1c value to the large body of published outcome data that use DCCT-aligned results.
A third miscommunication is “One untimed… blood sample for diagnosis”. The guidelines4 recommend that, in the absence of unequivocal hyperglycaemia (an uncommon finding), HbA1c be confirmed by repeat testing. It is essential for the medical community to understand these changes in HbA1c clearly to avoid negatively affecting care of diabetic patients.
We declare that we have no conflicts of interest.
References
1 Misra S, Hancock M, Meeran K, Dornhorst A, Oliver NS. HbA1c: an old friend in new clothes. Lancet 2011; 377: 1476-1477. Full Text | PDF(46KB) | CrossRef | PubMed
2 College of American Pathologists. GH2-A glycohemoglobin participant summary, 2011. Northfield, IL: CAP, 2011.
3 Geistanger A, Arends S, Berding C, et al. Statistical methods for monitoring the relationship between the IFCC reference measurement procedure for hemoglobin A1c and the designated comparison methods in the United States, Japan, and Sweden. Clin Chem 2008; 54: 1379-1385. CrossRef | PubMed
4 International Expert Committee. International Expert Committee report on the role of the A1C assay in the diagnosis of diabetes. Diabetes Care 2009; 32: 1327-1334. CrossRef | PubMed
The Lancet, Volume 378, Issue 9796, Pages 1069 - 1070, 17 September 2011
HbA1c: what do the numbers really mean? — Authors' reply
We do not believe that we have misled readers. The stated coefficients of variation refer to figures before the National Glycohemoglobin Standardization Program (NGSP) was implemented and were quoted to illustrate the different coefficients of variation in existence at the time of the Diabetes Control and Complications Trial (DCCT). Furthermore, the next paragraph clearly states that “harmonisation of results to DCCT-based calibrants in the 1990s partly alleviated this variation”. Although effective, the NGSP did not provide a reference measurement system, which has been the underlying driving force behind the International Federation of Clinical Chemistry (IFCC) standardisation.
In quoting “the DCCT-aligned results are now untraceable and cannot be linked… to the original reference measurement, making them effectively meaningless”, Randie Little and David Sacks chose to omit the phrase “through successive calibrations”. This statement referred to the use of DCCT-calibrated analysers, which are not in any way linked to the IFCC reference system. This practice would generate untraceable results. The consensus statement1 clearly indicates that the IFCC reference represents the only valid anchor to standardisation. We acknowledge that the use of the IFCC-NGSP master equation does permit traceability to the IFCC reference system. However, there are some crucial limitations, which underpin our reluctance to encourage physicians to undertake this conversion routinely.
First, although a linear relation exists between the IFCC-standardised and DCCT-aligned results, the latter cannot be considered a “pure” HbA1c measurement.2 Now that a pure HbA1c standard exists, one must question the validity of continuing to report DCCT-aligned results. To suggest that comparisons to outcome data necessitate interconversion is, in our opinion, ill-considered since the master equation can equally convert targets into new units.
Second, the use of the master equation generates further uncertainty in the derived DCCT-aligned values.3 Irrespective of whether this is significant, should the use of an equation to derive values from a reference be considered as robust as a system in which an unbroken chain of calibrations links the reference to the designated comparison method?4
Third, in the UK, DCCT percentage units will cease to be reported from October, 2011. We therefore actively encourage clinicians to familiarise themselves with the new units now. This is a fundamental course of action to avoid confusion later, which would undoubtedly be detrimental to patients' care.
We accept that a single measurement is not proposed; however, Little and Sacks have misunderstood the message being conveyed. Since guidelines5 advise repeat testing of an abnormal result by the same method, a second HbA1c measurement in a patient with an interfering factor will simply duplicate the error. It is important for clinicians to understand the limitations of a test, no matter how many times it is repeated.
References
1 Hanas R, John G. 2010 consensus statement on the worldwide standardization of the hemoglobin A1C measurement. Diabetes Care 2010; 33: 1903-1904. CrossRef | PubMed
2 European Association for the Study of Diabetes. Report of the ADA/EASD/IDF Working Group of the HbA1c Assay. London, UK, 20 January 2004. http://www.ifcchba1c.net/files/2004_Diabetologia2004_46_R53_54.pdf. (accessed Aug 3, 2011).
3 Geistanger A, Arends S, Berding C, et al. Statistical methods for monitoring the relationship between the IFCC reference measurement procedure for hemoglobin A1c and the designated comparison methods in the US, Japan and Sweden. Clin Chem 2008; 54: 1379-1385. CrossRef | PubMed
4 Joint Committee for Guides in Metrology. International vocabulary of metrology—basic and general concepts and associated terms. 3rd edn. http://www.bipm.org/utils/common/documents/jcgm/JCGM_200_2008.pdf. (accessed Aug 31, 2011).
5 WHO. Use of glycated haemoglobin (HbA1c) in the diagnosis of diabetes mellitus: abbreviated report of a WHO consultation. http://www.who.int/diabetes/publications/report-hba1c_2011.pdf. (accessed Aug 31, 2011).
a Imperial Healthcare NHS Trust, Charing Cross Hospital, London W6 8RF, UK

Thursday, September 15, 2011


Bariatric Surgery and Obesity and Diabetes – International Journal of Obesity, 09/2011
OVERVIEW
Collaboration between basic science researchers and bariatric surgeons is a win/win proposition: view from the chair
F-S Hould
Int J Obes 2011 35: S3-S6; 10.1038/ijo.2011.140

REVIEWS
Bariatric surgery, adipose tissue and gut microbiota
K Clément
Int J Obes 2011 35: S7-S15; 10.1038/ijo.2011.141

Bariatric surgery for treatment of obesity
S Eldar, H M Heneghan, S A Brethauer and P R Schauer
Int J Obes 2011 35: S16-S21; 10.1038/ijo.2011.142

Diabetes remission after bariatric surgery: is it just the incretins?
B Laferrère
Int J Obes 2011 35: S22-S25; 10.1038/ijo.2011.143

The mechanism of weight loss with laparoscopic adjustable gastric banding: induction of satiety not restriction
P R Burton and W A Brown
Int J Obes 2011 35: S26-S30; 10.1038/ijo.2011.144

Sunday, September 11, 2011

Multiple Imputation (MI)

Multiple Imputation (MI)

Wednesday, September 07, 2011

Writing, Speaking, and Reading

Writing, Speaking, and Reading

Thursday, September 01, 2011

Resampling and Monte Carlo Simulation



Resampling and Monte Carlo Simulation
Introduction
Generate data from a multivariate normal distribution (MVN)
Stata
SAS
R!