[R] useful functions

몇가지 손수 만든 R function 들인데 조잡하지만 나름 편리하게 이용하고 있습니다. extr.num 은 데이터 cleaning 할 때 outlier 들을 보는 데 유용하고, qw 는 perl 에서 쓰는 함수 명을 그대로 따왔는데 정확히 똑같진 않지만 여러 text 들을 하나의 vector 로 묶을 때 편합니다. 안 그러면 따옴표랑 쉼표 찍느라고 무지 번거롭죠. 그 중 logistic() 같은 것은 써보면 제법 편리할 겁니다. R 에서 logistic regression 을 하려면 보시는 바와 같이 glm (…) 으로 한참 길게 써야 하는 번거로움에다가, 우선 보고 싶은 게 odds ratio 인데 그걸 안보여준다는…! 어쩌자고 이리 만들어 놨는지는 모르겠지만… logistic 은 제가 데이터 분석할 때 logistic regression 할 때마다

[R] Pooled cohort equation (10-year absolute risk)

Pooled cohort equation 으로 10년 간의 심뇌혈관질환의 발병 위험도를 예측하는 공식을 R function 으로 구현하였습니다. ## Pooled cohort equation: implementing pooled cohort equation ## AR10 (ten-year absolute risk) = 1 – S^exp(XB – meanXB) ## S = survival rate at 10 yrs ## women and men, white ## gender M:1, F:2 ## bpl = BP lowering treatment, untreated or treated: 0 or 1 ## Reference: ## 2013 ACC/AHA Guideline on the Assessment of Cardiovascular Risk ## A Report of the American College of Cardiology/American Heart ## Association Task Force on Practice Guidelines ## Circulation. 2014;129[suppl 2]:S49-S73 pce