function [cm, scaled] = CASTERMeasure(data) %cm = CASTERMeasure(data) % % This function computes the CASTER measure of ICS response for a group of % input asthma subjects. % % input DATA must be a matrix of sample data where: % column 1 = BURSTS (count) % column 2 = ED/Hospitalizations (count) % column 3 = PREFEV1 PP: pre-bronchodilator fev1 percent predicted % (according to Hankinson equations for race/sex/age/height) % column 4 = LNPC20: natural log of PC20, methacholine challenge % column 5 = BDR %: percent change in FEV1 as a response to % bronchodilator (albuterol) % % output CM is the CASTER Measure of ICS Response, where higher is better. % output SCALED is the CASTER measure scaled to be between 0 and 1 based on % the distribution of CASTER scores in the CAMP cohort. % % % (C) Michael McGeachie, 2019. Open Source. % Distributed under the MIT License. % load weights / loadings and good/poor centroids: loadings = [-0.000329 -0.01628 0.004081;... -0.000052 -0.003218 -0.000595;... 0.002586 -0.000163 -0.000247;... 0.000147 0.006293 0.027399;... -0.000011 -0.000545 -0.002436]; poorcent = [0.004058 -0.062759 0.032017]; goodcent = [0.012256 0.005799 0.027421]; % CENTERING: data = data - mean(data); pcs = data * loadings; % compute CASTER measure (cm) here: dpoor = sum((pcs - poorcent).^2,2); dgood = sum((pcs - goodcent).^2,2); cm = dpoor - dgood; minCAMP = -0.0188; maxCAMP = 0.01; scaled = (cm - minCAMP) / (maxCAMP-minCAMP);